Fix clippy lints
This commit is contained in:
parent
707c994a76
commit
ea58ef0c8e
|
|
@ -210,7 +210,7 @@ fn generate_vial_config() {
|
|||
writedoc!(
|
||||
out_file,
|
||||
"
|
||||
#[allow(dead_code, non_camel_case_types)]
|
||||
#[allow(dead_code, non_camel_case_types, clippy::upper_case_acronyms)]
|
||||
#[repr(u8)]
|
||||
pub enum CustomKeycodes {{
|
||||
"
|
||||
|
|
|
|||
|
|
@ -1,35 +1,11 @@
|
|||
use core::alloc::Layout;
|
||||
use core::fmt::Debug;
|
||||
use core::ops::Index;
|
||||
use core::slice;
|
||||
|
||||
use alloc::alloc::Allocator;
|
||||
use alloc::boxed::Box;
|
||||
use alloc::collections::btree_map::{BTreeMap, Entry};
|
||||
use alloc::string::String;
|
||||
use alloc::sync::Arc;
|
||||
use alloc::vec::Vec;
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::channel::Channel;
|
||||
use embassy_time::Instant;
|
||||
use esp_alloc::{EspHeap, MemoryCapability};
|
||||
use itertools::Itertools;
|
||||
use log::{debug, error, info, warn};
|
||||
use rmk::config::{BehaviorConfig, ForksConfig, PositionalConfig};
|
||||
use rmk::descriptor::KeyboardReport;
|
||||
use rmk::fork::{Fork, StateBits};
|
||||
use rmk::futures::FutureExt;
|
||||
use rmk::hid::Report;
|
||||
use rmk::types::action::{Action, KeyAction};
|
||||
use rmk::types::modifier::ModifierCombination;
|
||||
use rmk::{a, heapless, join_all, k, layer};
|
||||
use slint::platform::Key;
|
||||
use static_cell::StaticCell;
|
||||
use xkbcommon::xkb::{self, FeedResult, KeyDirection, Keysym, ModIndex, ModMask, Status};
|
||||
use rmk::{a, heapless, k, layer};
|
||||
|
||||
use crate::util::{DurationExt, get_file_name};
|
||||
use crate::vial::CustomKeycodes;
|
||||
use crate::{KEYBOARD_REPORT_PROXY, PSRAM_ALLOCATOR};
|
||||
|
||||
pub const NUM_LAYER: usize = 8;
|
||||
pub const MATRIX_ROWS: usize = 5;
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ impl DbKey {
|
|||
|
||||
pub struct DbPathSpectreUsers;
|
||||
|
||||
impl<'a> IntoIterator for DbPathSpectreUsers {
|
||||
impl IntoIterator for DbPathSpectreUsers {
|
||||
type Item = DbPathSegment<'static>;
|
||||
type IntoIter = core::array::IntoIter<DbPathSegment<'static>, 2>;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ use core::{
|
|||
};
|
||||
|
||||
use critical_section::Mutex;
|
||||
use data_encoding_macro::hexlower;
|
||||
use embassy_sync::blocking_mutex::{self, raw::CriticalSectionRawMutex};
|
||||
use esp_sync::RawMutex;
|
||||
use hmac::digest::{FixedOutput, KeyInit, Update};
|
||||
use password_hash::Key;
|
||||
use sha2::{
|
||||
|
|
@ -89,6 +87,7 @@ unsafe extern "C" fn __spre_crypto_generichash_blake2b_salt_personal(
|
|||
todo!()
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[repr(C)]
|
||||
struct crypto_hash_sha256_state {
|
||||
state: [u32; 8],
|
||||
|
|
@ -96,6 +95,7 @@ struct crypto_hash_sha256_state {
|
|||
buf: [u8; 64],
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types, unused)]
|
||||
struct crypto_auth_hmacsha256_state {
|
||||
ictx: crypto_hash_sha256_state,
|
||||
octx: crypto_hash_sha256_state,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use core::ffi::{c_char, c_int};
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(non_camel_case_types, clippy::upper_case_acronyms)]
|
||||
pub enum DIR {}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use embassy_time::Instant;
|
||||
|
||||
// TODO: Is this right?
|
||||
#[allow(non_camel_case_types)]
|
||||
pub type time_t = i64;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
use core::fmt::Write;
|
||||
use core::{cell::RefCell, fmt::Arguments};
|
||||
use core::fmt::Arguments;
|
||||
|
||||
use critical_section::{CriticalSection, Mutex};
|
||||
use esp_hal::Blocking;
|
||||
use esp_hal::clock::CpuClock;
|
||||
use esp_hal::psram::{FlashFreq, PsramConfig, PsramSize, SpiRamFreq, SpiTimingConfigCoreClock};
|
||||
use esp_hal::uart::UartTx;
|
||||
use log::{LevelFilter, Log};
|
||||
use log::LevelFilter;
|
||||
|
||||
pub const LOG_LEVEL_FILTER: LevelFilter = {
|
||||
if let Some(string) = option_env!("ESP_LOG") {
|
||||
|
|
|
|||
|
|
@ -61,27 +61,23 @@ use itertools::Itertools;
|
|||
use log::{error, info, warn};
|
||||
use rmk::channel::{CONTROLLER_CHANNEL, ControllerSub};
|
||||
use rmk::config::{
|
||||
BehaviorConfig, DeviceConfig, ForksConfig, PositionalConfig, RmkConfig, StorageConfig,
|
||||
DeviceConfig, RmkConfig, StorageConfig,
|
||||
VialConfig,
|
||||
};
|
||||
use rmk::controller::{Controller, EventController};
|
||||
use rmk::debounce::default_debouncer::DefaultDebouncer;
|
||||
use rmk::event::ControllerEvent;
|
||||
use rmk::fork::{Fork, StateBits};
|
||||
use rmk::hid::Report;
|
||||
use rmk::input_device::Runnable;
|
||||
use rmk::keyboard::Keyboard;
|
||||
use rmk::storage::async_flash_wrapper;
|
||||
use rmk::types::action::{Action, KeyAction};
|
||||
use rmk::types::keycode::KeyCode;
|
||||
use rmk::types::modifier::ModifierCombination;
|
||||
use rmk::{heapless, join_all};
|
||||
use rmk::join_all;
|
||||
use rmk::{initialize_keymap_and_storage, run_devices, run_rmk};
|
||||
use slint::platform::software_renderer::Rgb565Pixel;
|
||||
use static_cell::StaticCell;
|
||||
use {esp_alloc as _, esp_backtrace as _};
|
||||
|
||||
use crate::logging::LOG_LEVEL_FILTER;
|
||||
use crate::matrix::IoeMatrix;
|
||||
use crate::peripherals::st7701s::St7701s;
|
||||
use crate::proxy::create_hid_report_interceptor;
|
||||
|
|
@ -392,12 +388,12 @@ async fn main(_spawner: Spawner) {
|
|||
start_addr: 0,
|
||||
num_sectors: {
|
||||
assert!(
|
||||
flash_part_info_rmk.len() as u32 % FlashStorage::SECTOR_SIZE == 0,
|
||||
flash_part_info_rmk.len() % FlashStorage::SECTOR_SIZE == 0,
|
||||
"The size of the RMK partition must be a multiple of {} bytes. Current size: {}",
|
||||
FlashStorage::SECTOR_SIZE,
|
||||
flash_part_info_rmk.len()
|
||||
);
|
||||
(flash_part_info_rmk.len() as u32 / FlashStorage::SECTOR_SIZE) as u8
|
||||
(flash_part_info_rmk.len() / FlashStorage::SECTOR_SIZE) as u8
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
|
@ -425,7 +421,6 @@ async fn main(_spawner: Spawner) {
|
|||
device_config,
|
||||
vial_config,
|
||||
storage_config,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Initialze keyboard stuffs
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use core::alloc::Layout;
|
||||
use core::fmt::Debug;
|
||||
use core::ops::Index;
|
||||
use core::slice;
|
||||
|
||||
use alloc::alloc::Allocator;
|
||||
|
|
@ -13,20 +12,14 @@ use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
|||
use embassy_sync::channel::Channel;
|
||||
use embassy_time::Instant;
|
||||
use esp_alloc::{EspHeap, MemoryCapability};
|
||||
use itertools::Itertools;
|
||||
use log::{debug, error, info, warn};
|
||||
use rmk::descriptor::KeyboardReport;
|
||||
use rmk::futures::FutureExt;
|
||||
use rmk::hid::Report;
|
||||
use rmk::types::action::{Action, KeyAction};
|
||||
use rmk::{a, heapless, join_all, k, layer};
|
||||
use rmk::{heapless, join_all};
|
||||
use slint::platform::Key;
|
||||
use static_cell::StaticCell;
|
||||
use xkbcommon::xkb::{self, FeedResult, KeyDirection, Keysym, ModIndex, ModMask, Status};
|
||||
use xkbcommon::xkb::{self, FeedResult, KeyDirection, Keysym, ModMask, Status};
|
||||
|
||||
use crate::config::{MATRIX_COLS, MATRIX_ROWS};
|
||||
use crate::util::{DurationExt, get_file_name};
|
||||
use crate::vial::CustomKeycodes;
|
||||
use crate::{KEYBOARD_REPORT_PROXY, PSRAM_ALLOCATOR};
|
||||
|
||||
pub static KEY_MESSAGE_CHANNEL: Channel<CriticalSectionRawMutex, KeyMessage, 16> = Channel::new();
|
||||
|
|
@ -199,15 +192,15 @@ async fn send_strings_to_host<A: Allocator>(
|
|||
let mut index = 0;
|
||||
|
||||
while remaining_mask != 0 {
|
||||
if remaining_mask & 1 != 0 {
|
||||
if let Some(mod_descriptor) = modifier_xkb_index_to_descriptor[index] {
|
||||
if let Some(hid_flag) = mod_descriptor.hid_flag {
|
||||
modifier |= hid_flag;
|
||||
}
|
||||
if remaining_mask & 1 != 0
|
||||
&& let Some(mod_descriptor) = modifier_xkb_index_to_descriptor[index]
|
||||
{
|
||||
if let Some(hid_flag) = mod_descriptor.hid_flag {
|
||||
modifier |= hid_flag;
|
||||
}
|
||||
|
||||
if let Some(keycode) = mod_descriptor.keycode {
|
||||
let _ = keycodes_vec.push(keycode);
|
||||
}
|
||||
if let Some(keycode) = mod_descriptor.keycode {
|
||||
let _ = keycodes_vec.push(keycode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -432,7 +425,7 @@ pub struct HidKeycodeWithMods {
|
|||
|
||||
pub fn string_to_hid_keycodes(
|
||||
keymap: &xkb::Keymap,
|
||||
compose_table: &xkb::compose::Table,
|
||||
_compose_table: &xkb::compose::Table,
|
||||
string: &str,
|
||||
) -> Result<Vec<HidKeycodeWithMods, &'static EspHeap>, char> {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
|
|
@ -582,7 +575,7 @@ pub const fn xkb_to_hid_keycode(xkb_keycode: xkb::Keycode) -> Option<u8> {
|
|||
let mut hid: u8 = 0;
|
||||
|
||||
loop {
|
||||
xkb_to_hid[hid_to_xkb_keycode_inner(hid as u8) as usize] = hid;
|
||||
xkb_to_hid[hid_to_xkb_keycode_inner(hid) as usize] = hid;
|
||||
let overflow;
|
||||
(hid, overflow) = hid.overflowing_add(1);
|
||||
if overflow {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use alloc::{
|
|||
use critical_section::Mutex;
|
||||
use esp_hal::time::Instant;
|
||||
use log::{debug, info};
|
||||
use rmk::futures::sink::drain;
|
||||
use slint::{
|
||||
EventLoopError, PhysicalSize, SharedString, WindowSize,
|
||||
platform::{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// #![cfg_attr(not(feature = "simulator"), no_main)]
|
||||
|
||||
use core::{cell::RefCell, ffi::CStr, ops::DerefMut, pin::Pin};
|
||||
use core::{cell::RefCell, ffi::CStr, pin::Pin};
|
||||
|
||||
use alloc::{
|
||||
borrow::Cow,
|
||||
|
|
@ -17,14 +17,13 @@ use hex::FromHexError;
|
|||
use i_slint_core::model::{ModelChangeListener, ModelChangeListenerContainer};
|
||||
use log::{error, info, warn};
|
||||
use password_hash::Key;
|
||||
use rmk::futures::{FutureExt, TryFutureExt};
|
||||
use slint::{
|
||||
Model, ModelExt, ModelNotify, ModelRc, ModelTracker, SharedString, StandardListViewItem,
|
||||
VecModel,
|
||||
};
|
||||
use spectre_api_sys::{
|
||||
SpectreAlgorithm, SpectreCounter, SpectreKeyID, SpectreKeyPurpose, SpectreResultType,
|
||||
SpectreSiteKey, SpectreUserKey,
|
||||
SpectreUserKey,
|
||||
};
|
||||
|
||||
#[cfg(feature = "limit-fps")]
|
||||
|
|
@ -453,7 +452,7 @@ impl AppViewTrait for StateLogin {
|
|||
|
||||
if user.key_id != user_key.keyID.bytes {
|
||||
State::process_callback_message(
|
||||
&state_rc,
|
||||
state_rc,
|
||||
CallbackMessage::Login(CallbackMessageLogin::LoginResult {
|
||||
username: user.username,
|
||||
result: LoginResult::Failure,
|
||||
|
|
@ -494,7 +493,7 @@ impl AppViewTrait for StateLogin {
|
|||
let mut key_segments = key.segments();
|
||||
let value = &buffer[..value_len];
|
||||
let site_config =
|
||||
postcard::from_bytes::<SpectreSiteConfig>(&value).unwrap();
|
||||
postcard::from_bytes::<SpectreSiteConfig>(value).unwrap();
|
||||
let site = SpectreSite {
|
||||
config: site_config,
|
||||
username: key_segments.nth(2).unwrap().as_ref().into(),
|
||||
|
|
@ -683,10 +682,10 @@ impl AppViewTrait for StateUserEdit {
|
|||
let mut existing_index = None;
|
||||
|
||||
for index in 0..state.users.users.row_count() {
|
||||
if let Some(current_user) = state.users.users.row_data(index) {
|
||||
if current_user.username == user.username {
|
||||
existing_index = Some(index);
|
||||
}
|
||||
if let Some(current_user) = state.users.users.row_data(index)
|
||||
&& current_user.username == user.username
|
||||
{
|
||||
existing_index = Some(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use core::fmt::{Debug, Formatter};
|
||||
|
||||
use alloc::{rc::Rc, string::String, vec::Vec};
|
||||
use alloc::rc::Rc;
|
||||
use chrono::NaiveDateTime;
|
||||
use password_hash::Key;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use slint::{Model, ModelRc, SharedString, VecModel};
|
||||
use slint::{Model, SharedString, VecModel};
|
||||
use spectre_api_sys::{SpectreAlgorithm, SpectreCounter, SpectreResultType};
|
||||
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue