From ab3ffac20db0e76a4f7be43799221eb506037223 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Thu, 21 Oct 2021 10:49:23 -0600 Subject: [PATCH 1/3] Add license info to files Add SPDX headers and declare license in the manifest. Signed-off-by: Tim Crawford --- Cargo.toml | 1 + examples/pmc.rs | 2 ++ examples/support/mod.rs | 2 ++ src/cmd/int.rs | 2 ++ src/cmd/kbc.rs | 2 ++ src/cmd/mod.rs | 2 ++ src/cmd/pmc.rs | 2 ++ src/ec.rs | 2 ++ src/main.rs | 2 ++ src/socket.rs | 2 ++ src/spi.rs | 2 ++ src/xram.rs | 2 ++ 12 files changed, 23 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 119b450..846df51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "ecsim" version = "0.1.0" authors = ["Jeremy Soller "] edition = "2018" +license = "MIT" [dependencies] area8051 = { path = "area8051" } diff --git a/examples/pmc.rs b/examples/pmc.rs index c8a1582..b3975db 100644 --- a/examples/pmc.rs +++ b/examples/pmc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + /// Example of resetting KBC - communicates with running ecsim over socket use std::io; diff --git a/examples/support/mod.rs b/examples/support/mod.rs index 96ed21a..51c5b48 100644 --- a/examples/support/mod.rs +++ b/examples/support/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use std::io; use std::net::UdpSocket; diff --git a/src/cmd/int.rs b/src/cmd/int.rs index e2993a1..cef9d24 100644 --- a/src/cmd/int.rs +++ b/src/cmd/int.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use area8051::Isa; use crate::Ec; diff --git a/src/cmd/kbc.rs b/src/cmd/kbc.rs index 13230e5..52180b7 100644 --- a/src/cmd/kbc.rs +++ b/src/cmd/kbc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use crate::Ec; const STATUS_CMD: u8 = 1 << 3; diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 9360db7..6b58bb1 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + pub mod int; pub mod kbc; pub mod pmc; diff --git a/src/cmd/pmc.rs b/src/cmd/pmc.rs index b9b0bec..911f8eb 100644 --- a/src/cmd/pmc.rs +++ b/src/cmd/pmc.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use crate::Ec; const STATUS_CMD: u8 = 1 << 3; diff --git a/src/ec.rs b/src/ec.rs index 8ba20d8..26b54a7 100644 --- a/src/ec.rs +++ b/src/ec.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use area8051::{Addr, Isa, Mcu, Mem, Reg}; use std::sync::Mutex; diff --git a/src/main.rs b/src/main.rs index 2e7aeda..ccfeb08 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use area8051::{Addr, Isa, Mem}; use std::{env, fs, io}; use std::collections::{BTreeMap, HashMap}; diff --git a/src/socket.rs b/src/socket.rs index 5e98e0e..8049725 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use crate::ec::Ec; #[cfg(feature = "debug_socket")] diff --git a/src/spi.rs b/src/spi.rs index 407deb6..82e3a84 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use std::collections::VecDeque; #[cfg(feature = "debug_spi")] diff --git a/src/xram.rs b/src/xram.rs index a6ccd6b..352c395 100644 --- a/src/xram.rs +++ b/src/xram.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MIT + use area8051::{Addr, Mem}; use crate::Ec; From 59ab4066da55e06c0887d649b3da0ade0f1ae5c6 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Thu, 21 Oct 2021 10:49:23 -0600 Subject: [PATCH 2/3] Update dependencies Signed-off-by: Tim Crawford --- Cargo.lock | 202 ++++++++++++++++++++++++++++++++++++---------------- Cargo.toml | 2 +- area8051 | 2 +- src/main.rs | 2 +- 4 files changed, 143 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f22a905..cc71a95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,163 +1,241 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "area8051" version = "0.1.0" +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + [[package]] name = "bitflags" -version = "1.2.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bytecount" -version = "0.3.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72feb31ffc86498dacdbd0fcebb56138e7177a8cc5cea4516031d15ae85a742e" [[package]] name = "cc" -version = "1.0.45" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" [[package]] name = "cfg-if" -version = "0.1.10" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "ctrlc" -version = "3.1.3" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf" dependencies = [ - "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "nix", + "winapi", ] [[package]] name = "ecsim" version = "0.1.0" dependencies = [ - "area8051 0.1.0", - "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "liner 0.5.0 (git+https://gitlab.redox-os.org/redox-os/liner.git)", + "area8051", + "ctrlc", + "redox_liner", ] [[package]] name = "either" -version = "1.5.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "itertools" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ - "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either", ] [[package]] name = "libc" -version = "0.2.62" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce" [[package]] -name = "liner" -version = "0.5.0" -source = "git+https://gitlab.redox-os.org/redox-os/liner.git#3f3d1d4e6058067e9d03a9b1510d8f2edac073c7" +name = "memoffset" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" dependencies = [ - "bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.3 (git+https://gitlab.redox-os.org/redox-os/termion)", - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg", ] [[package]] name = "nix" -version = "0.14.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f305c2c2e4c39a82f7bf0bf65fb557f9070ce06781d4f2454295cc34b1c43188" dependencies = [ - "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags", + "cc", + "cfg-if", + "libc", + "memoffset", ] [[package]] name = "numtoa" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" + +[[package]] +name = "proc-macro2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc3358ebc67bc8b7fa0c007f945b0b18226f78437d61bec735a9eb96b61ee70" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_liner" +version = "0.5.1" +source = "git+https://gitlab.redox-os.org/redox-os/liner.git#616e61657fd611c3fe5818e6151300cbcbdd5c06" +dependencies = [ + "bytecount", + "itertools", + "strip-ansi-escapes", + "termion", + "unicode-width", +] [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] [[package]] name = "redox_termios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +dependencies = [ + "redox_syscall", +] + +[[package]] +name = "strip-ansi-escapes" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "011cbb39cf7c1f62871aea3cc46e5817b0937b49e9447370c93cacbe93a766d8" dependencies = [ - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "vte", ] [[package]] name = "termion" -version = "1.5.3" -source = "git+https://gitlab.redox-os.org/redox-os/termion#c27678efc2ed14576361c7ce6d806a6bb576f1a9" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ - "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc", + "numtoa", + "redox_syscall", + "redox_termios", ] [[package]] name = "unicode-width" -version = "0.1.6" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "utf8parse" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" [[package]] -name = "void" -version = "1.0.2" +name = "vte" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cbce692ab4ca2f1f3047fcf732430249c0e971bfdd2b234cf2c47ad93af5983" +dependencies = [ + "arrayvec", + "utf8parse", + "vte_generate_state_changes", +] + +[[package]] +name = "vte_generate_state_changes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" +dependencies = [ + "proc-macro2", + "quote", +] [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2" -"checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8" -"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7dfd2d8b4c82121dfdff120f818e09fc4380b0b7e17a742081a89b94853e87f" -"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" -"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" -"checksum liner 0.5.0 (git+https://gitlab.redox-os.org/redox-os/liner.git)" = "" -"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum termion 1.5.3 (git+https://gitlab.redox-os.org/redox-os/termion)" = "" -"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 846df51..af2bf94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" [dependencies] area8051 = { path = "area8051" } ctrlc = "3.1.3" -liner = { git = "https://gitlab.redox-os.org/redox-os/liner.git" } +redox_liner = { git = "https://gitlab.redox-os.org/redox-os/liner.git" } [features] default = [] diff --git a/area8051 b/area8051 index 1644b66..2be60ca 160000 --- a/area8051 +++ b/area8051 @@ -1 +1 @@ -Subproject commit 1644b66fd13d81ccb8f09e7abdf5bffedfdabe86 +Subproject commit 2be60cac8994810214a57becec0ae61f7029aa0e diff --git a/src/main.rs b/src/main.rs index ccfeb08..31cf248 100644 --- a/src/main.rs +++ b/src/main.rs @@ -308,7 +308,7 @@ fn main() { } match con.read_line( - "[ecsim]$ ", + liner::Prompt::from("[ecsim]$ "), None, &mut Completer { commands: &commands, From afa29cc958db956dc84a86366aa388275008325d Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Thu, 21 Oct 2021 10:49:23 -0600 Subject: [PATCH 3/3] Fix clippy warnings on nightly Fix warnings: - unused_variables - clippy::if_then_panic - clippy::or_fun_call - clippy::for_kv_map - clippy::needless_borrow Silence warnings: - clippy::match_single_binding - clippy::new_without_default - clippy::from_str_radix_10 - clippy::needless_range_loop Signed-off-by: Tim Crawford --- src/cmd/int.rs | 2 +- src/cmd/kbc.rs | 4 ++-- src/cmd/mod.rs | 2 ++ src/cmd/pmc.rs | 4 ++-- src/main.rs | 14 +++++--------- src/socket.rs | 1 + src/spi.rs | 11 +++++++---- src/xram.rs | 8 ++++---- 8 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/cmd/int.rs b/src/cmd/int.rs index cef9d24..3a06607 100644 --- a/src/cmd/int.rs +++ b/src/cmd/int.rs @@ -10,7 +10,7 @@ pub fn int(ec: &mut Ec, args: &[&str]) { return; } - let int = match u8::from_str_radix(&args[0], 10) { + let int = match u8::from_str_radix(args[0], 10) { Ok(ok) => if ok <= 5 { ok } else { diff --git a/src/cmd/kbc.rs b/src/cmd/kbc.rs index 52180b7..6f4cf3c 100644 --- a/src/cmd/kbc.rs +++ b/src/cmd/kbc.rs @@ -17,7 +17,7 @@ pub fn cmd(ec: &mut Ec, args: &[&str]) { return; } - let data = match u8::from_str_radix(&args[0], 16) { + let data = match u8::from_str_radix(args[0], 16) { Ok(ok) => ok, Err(err) => { eprintln!("argument '{}' failed to parse as hex: {}", args[0], err); @@ -55,7 +55,7 @@ pub fn write(ec: &mut Ec, args: &[&str]) { return; } - let data = match u8::from_str_radix(&args[0], 16) { + let data = match u8::from_str_radix(args[0], 16) { Ok(ok) => ok, Err(err) => { eprintln!("argument '{}' failed to parse as hex: {}", args[0], err); diff --git a/src/cmd/mod.rs b/src/cmd/mod.rs index 6b58bb1..65a8720 100644 --- a/src/cmd/mod.rs +++ b/src/cmd/mod.rs @@ -1,5 +1,7 @@ // SPDX-License-Identifier: MIT +#![allow(clippy::from_str_radix_10)] + pub mod int; pub mod kbc; pub mod pmc; diff --git a/src/cmd/pmc.rs b/src/cmd/pmc.rs index 911f8eb..88f3320 100644 --- a/src/cmd/pmc.rs +++ b/src/cmd/pmc.rs @@ -16,7 +16,7 @@ pub fn cmd(ec: &mut Ec, args: &[&str]) { return; } - let data = match u8::from_str_radix(&args[0], 16) { + let data = match u8::from_str_radix(args[0], 16) { Ok(ok) => ok, Err(err) => { eprintln!("argument '{}' failed to parse as hex: {}", args[0], err); @@ -44,7 +44,7 @@ pub fn write(ec: &mut Ec, args: &[&str]) { return; } - let data = match u8::from_str_radix(&args[0], 16) { + let data = match u8::from_str_radix(args[0], 16) { Ok(ok) => ok, Err(err) => { eprintln!("argument '{}' failed to parse as hex: {}", args[0], err); diff --git a/src/main.rs b/src/main.rs index 31cf248..9722105 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,7 +29,7 @@ struct Completer<'a> { impl<'a> liner::Completer for Completer<'a> { fn completions(&mut self, start: &str) -> Vec { let mut completions = Vec::new(); - for (name, _func) in self.commands { + for name in self.commands.keys() { if name.starts_with(start) { completions.push(name.to_string()); } @@ -118,7 +118,7 @@ fn commands() -> CommandMap { }; mcu.xram[addr] = value; - + eprintln!("xram {:04X}: {:02X}", addr, mcu.xram[addr]); } } else { @@ -164,9 +164,7 @@ fn timers(ec: &mut Ec) { // Timer 0 running if tcon & 1 << 4 != 0 { - if tmod & 0x0F != 0x01 { - panic!("unimplemented TMOD 0x{:02X}", tmod); - } + assert!(tmod & 0x0F == 0x01, "unimplemented TMOD 0x{:02X}", tmod); if ec.steps % 12 == 0 { let tl = 0x8A; @@ -190,9 +188,7 @@ fn timers(ec: &mut Ec) { // Timer 1 running if tcon & 1 << 6 != 0 { - if tmod & 0xF0 != 0x10 { - panic!("unimplemented TMOD 0x{:02X}", tmod); - } + assert!(tmod & 0xF0 == 0x10, "unimplemented TMOD 0x{:02X}", tmod); if ec.steps % 12 == 0 { let tl = 0x8B; @@ -222,7 +218,7 @@ fn main() { RUNNING.store(false, Ordering::SeqCst); }).expect("failed to set ctrl-c handler"); - let pmem_path = env::args().nth(1).unwrap_or("ec.rom".to_string()); + let pmem_path = env::args().nth(1).unwrap_or_else(|| "ec.rom".to_string()); let mut pmem = fs::read(&pmem_path).expect("failed to read ec.rom"); diff --git a/src/socket.rs b/src/socket.rs index 8049725..0bdb5cd 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -98,6 +98,7 @@ pub fn socket_op(ec: &mut Ec, request: &[u8; 4]) -> [u8; 1] { }, 0x2f => { debug!(" (super io data 0x{:02X})", ec.superio_addr); + #[allow(clippy::match_single_binding)] match ec.superio_addr { _ => { debug!(" (unimplemented)"); diff --git a/src/spi.rs b/src/spi.rs index 82e3a84..b62ed6b 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -1,5 +1,7 @@ // SPDX-License-Identifier: MIT +#![allow(clippy::needless_range_loop)] + use std::collections::VecDeque; #[cfg(feature = "debug_spi")] @@ -20,6 +22,7 @@ pub struct Spi { pub output: VecDeque, } +#[allow(clippy::new_without_default)] impl Spi { pub fn new() -> Self { Self { @@ -31,9 +34,9 @@ impl Spi { } } - pub fn step(&mut self, flash: &mut [u8], flash_name: &str) { + pub fn step(&mut self, flash: &mut [u8], _flash_name: &str) { if let Some(command) = self.input.pop_front() { - debug!("\n[spi {}", flash_name); + debug!("\n[spi {}", _flash_name); self.fast_read_addr = None; @@ -41,9 +44,9 @@ impl Spi { 0x01 => { debug!(" write status"); - let value = self.input.pop_front().expect("spi wrate status value missing"); + let _value = self.input.pop_front().expect("spi wrate status value missing"); - debug!(" 0x{:02X}", value); + debug!(" 0x{:02X}", _value); }, 0x02 => { debug!(" page program"); diff --git a/src/xram.rs b/src/xram.rs index 352c395..8a47226 100644 --- a/src/xram.rs +++ b/src/xram.rs @@ -583,8 +583,8 @@ pub fn xram(ec: &Ec, address: u16, new_opt: Option) -> u8 { // BRAM 0x2200 ..= 0x22FF => { let base = 0x2200; - let offset = address - base; - debug!(" (BRAM 0x{:02X})", offset); + let _offset = address - base; + debug!(" (BRAM 0x{:02X})", _offset); }, // PECI 0x3000 ..= 0x30FF => { @@ -632,8 +632,8 @@ pub fn xram(ec: &Ec, address: u16, new_opt: Option) -> u8 { }, 0x8000 ..= 0x97FF if ec.id == 0x5570 => { let base = 0x8000; - let offset = address - base; - debug!(" (SRAM 0x{:02X})", offset); + let _offset = address - base; + debug!(" (SRAM 0x{:02X})", _offset); } _ => panic!("xram unimplemented register 0x{:04X}", address), }