mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
auto clippy fixes
This commit is contained in:
parent
72c85efc83
commit
ef39bad7c6
146 changed files with 750 additions and 1005 deletions
|
@ -172,7 +172,7 @@ impl Symbol {
|
|||
|
||||
#[cfg(debug_assertions)]
|
||||
pub fn contains(self, needle: &str) -> bool {
|
||||
format!("{:?}", self).contains(needle)
|
||||
format!("{self:?}").contains(needle)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ impl fmt::Debug for Symbol {
|
|||
match DEBUG_IDENT_IDS_BY_MODULE_ID.lock() {
|
||||
Ok(names) => match &names.get(&(module_id.to_zero_indexed() as u32)) {
|
||||
Some(ident_ids) => match ident_ids.get_name(ident_id) {
|
||||
Some(ident_str) => write!(f, "`{:?}.{}`", module_id, ident_str),
|
||||
Some(ident_str) => write!(f, "`{module_id:?}.{ident_str}`"),
|
||||
None => fallback_debug_fmt(*self, f),
|
||||
},
|
||||
None => fallback_debug_fmt(*self, f),
|
||||
|
@ -207,7 +207,7 @@ impl fmt::Debug for Symbol {
|
|||
use std::io::Write;
|
||||
|
||||
let mut stderr = std::io::stderr();
|
||||
writeln!(stderr, "DEBUG INFO: Failed to acquire lock for Debug reading from DEBUG_IDENT_IDS_BY_MODULE_ID, presumably because a thread panicked: {:?}", err).unwrap();
|
||||
writeln!(stderr, "DEBUG INFO: Failed to acquire lock for Debug reading from DEBUG_IDENT_IDS_BY_MODULE_ID, presumably because a thread panicked: {err:?}").unwrap();
|
||||
|
||||
fallback_debug_fmt(*self, f)
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ impl fmt::Display for Symbol {
|
|||
let ident_id = self.ident_id();
|
||||
|
||||
match ident_id {
|
||||
IdentId(value) => write!(f, "{:?}.{:?}", module_id, value),
|
||||
IdentId(value) => write!(f, "{module_id:?}.{value:?}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ fn fallback_debug_fmt(symbol: Symbol, f: &mut fmt::Formatter) -> fmt::Result {
|
|||
let module_id = symbol.module_id();
|
||||
let ident_id = symbol.ident_id();
|
||||
|
||||
write!(f, "`{:?}.{:?}`", module_id, ident_id)
|
||||
write!(f, "`{module_id:?}.{ident_id:?}`")
|
||||
}
|
||||
|
||||
/// This is used in Debug builds only, to let us have a Debug instance
|
||||
|
@ -312,8 +312,8 @@ pub fn get_module_ident_ids<'a>(
|
|||
all_ident_ids
|
||||
.get(module_id)
|
||||
.with_context(|| ModuleIdNotFoundSnafu {
|
||||
module_id: format!("{:?}", module_id),
|
||||
all_ident_ids: format!("{:?}", all_ident_ids),
|
||||
module_id: format!("{module_id:?}"),
|
||||
all_ident_ids: format!("{all_ident_ids:?}"),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ pub fn get_module_ident_ids_mut<'a>(
|
|||
all_ident_ids
|
||||
.get_mut(module_id)
|
||||
.with_context(|| ModuleIdNotFoundSnafu {
|
||||
module_id: format!("{:?}", module_id),
|
||||
module_id: format!("{module_id:?}"),
|
||||
all_ident_ids: "I could not return all_ident_ids here because of borrowing issues.",
|
||||
})
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ impl fmt::Debug for ModuleId {
|
|||
|
||||
if PRETTY_PRINT_DEBUG_SYMBOLS {
|
||||
match names.try_get(self.to_zero_indexed()) {
|
||||
Some(str_ref) => write!(f, "{}", str_ref),
|
||||
Some(str_ref) => write!(f, "{str_ref}"),
|
||||
None => {
|
||||
internal_error!(
|
||||
"Could not find a Debug name for module ID {} in {:?}",
|
||||
|
@ -645,7 +645,7 @@ impl IdentIds {
|
|||
pub fn update_key(&mut self, old_name: &str, new_name: &str) -> Result<IdentId, String> {
|
||||
match self.interner.find_and_update(old_name, new_name) {
|
||||
Some(index) => Ok(IdentId(index as u32)),
|
||||
None => Err(format!("The identifier {:?} is not in IdentIds", old_name)),
|
||||
None => Err(format!("The identifier {old_name:?} is not in IdentIds")),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ impl IdentIds {
|
|||
self.get_name(ident_id)
|
||||
.with_context(|| IdentIdNotFoundSnafu {
|
||||
ident_id,
|
||||
ident_ids_str: format!("{:?}", self),
|
||||
ident_ids_str: format!("{self:?}"),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue