1
0
forked from M-Labs/nac3

[meta] Apply clippy suggestions

This commit is contained in:
David Mak 2024-12-09 12:08:23 +08:00
parent 95254f8464
commit ac978864f2
2 changed files with 5 additions and 4 deletions

View File

@ -1085,7 +1085,7 @@ impl Nac3 {
let working_directory = tempfile::Builder::new().prefix("nac3-").tempdir().unwrap();
fs::write(working_directory.path().join("kernel.ld"), include_bytes!("kernel.ld")).unwrap();
let mut string_store: HashMap<String, i32> = Default::default();
let mut string_store: HashMap<String, i32> = HashMap::default();
// Keep this list of exceptions in sync with `EXCEPTION_ID_LOOKUP` in `artiq::firmware::ksupport::eh_artiq`
// The exceptions declared here must be defined in `artiq.coredevice.exceptions`
@ -1120,10 +1120,11 @@ impl Nac3 {
let exn_name = if name.find(':').is_none() {
format!("0:artiq.coredevice.exceptions.{name}")
} else {
name.to_string()
(*name).to_string()
};
string_store.insert(exn_name, i as i32);
let id = i32::try_from(i).unwrap();
string_store.insert(exn_name, id);
}
Ok(Nac3 {

View File

@ -1536,7 +1536,7 @@ impl SymbolResolver for Resolver {
if let Some(id) = string_store.get(s) {
*id
} else {
let id = string_store.len() as i32;
let id = i32::try_from(string_store.len()).unwrap();
string_store.insert(s.into(), id);
id
}