mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
auto clippy fixes
This commit is contained in:
parent
72c85efc83
commit
ef39bad7c6
146 changed files with 750 additions and 1005 deletions
|
@ -469,8 +469,7 @@ impl IAbilitiesStore<Resolved> {
|
|||
|
||||
debug_assert!(
|
||||
old_specialization.is_none(),
|
||||
"Existing resolution: {:?}",
|
||||
old_specialization
|
||||
"Existing resolution: {old_specialization:?}"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ impl Constraints {
|
|||
|
||||
let mut buf = String::new();
|
||||
|
||||
writeln!(buf, "Constraints statistics for module {:?}:", module_id)?;
|
||||
writeln!(buf, "Constraints statistics for module {module_id:?}:")?;
|
||||
|
||||
writeln!(buf, " constraints length: {}:", self.constraints.len())?;
|
||||
writeln!(
|
||||
|
@ -853,16 +853,16 @@ impl std::fmt::Debug for Constraint {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Eq(Eq(arg0, arg1, arg2, arg3)) => {
|
||||
write!(f, "Eq({:?}, {:?}, {:?}, {:?})", arg0, arg1, arg2, arg3)
|
||||
write!(f, "Eq({arg0:?}, {arg1:?}, {arg2:?}, {arg3:?})")
|
||||
}
|
||||
Self::Store(arg0, arg1, arg2, arg3) => {
|
||||
write!(f, "Store({:?}, {:?}, {:?}, {:?})", arg0, arg1, arg2, arg3)
|
||||
write!(f, "Store({arg0:?}, {arg1:?}, {arg2:?}, {arg3:?})")
|
||||
}
|
||||
Self::Lookup(arg0, arg1, arg2) => {
|
||||
write!(f, "Lookup({:?}, {:?}, {:?})", arg0, arg1, arg2)
|
||||
write!(f, "Lookup({arg0:?}, {arg1:?}, {arg2:?})")
|
||||
}
|
||||
Self::Pattern(arg0, arg1, arg2, arg3) => {
|
||||
write!(f, "Pattern({:?}, {:?}, {:?}, {:?})", arg0, arg1, arg2, arg3)
|
||||
write!(f, "Pattern({arg0:?}, {arg1:?}, {arg2:?}, {arg3:?})")
|
||||
}
|
||||
Self::True => write!(f, "True"),
|
||||
Self::SaveTheEnvironment => write!(f, "SaveTheEnvironment"),
|
||||
|
@ -871,27 +871,19 @@ impl std::fmt::Debug for Constraint {
|
|||
Self::IsOpenType(arg0) => f.debug_tuple("IsOpenType").field(arg0).finish(),
|
||||
Self::IncludesTag(arg0) => f.debug_tuple("IncludesTag").field(arg0).finish(),
|
||||
Self::PatternPresence(arg0, arg1, arg2, arg3) => {
|
||||
write!(
|
||||
f,
|
||||
"PatternPresence({:?}, {:?}, {:?}, {:?})",
|
||||
arg0, arg1, arg2, arg3
|
||||
)
|
||||
write!(f, "PatternPresence({arg0:?}, {arg1:?}, {arg2:?}, {arg3:?})")
|
||||
}
|
||||
Self::Exhaustive(arg0, arg1, arg2, arg3) => {
|
||||
write!(
|
||||
f,
|
||||
"Exhaustive({:?}, {:?}, {:?}, {:?})",
|
||||
arg0, arg1, arg2, arg3
|
||||
)
|
||||
write!(f, "Exhaustive({arg0:?}, {arg1:?}, {arg2:?}, {arg3:?})")
|
||||
}
|
||||
Self::Resolve(arg0) => {
|
||||
write!(f, "Resolve({:?})", arg0)
|
||||
write!(f, "Resolve({arg0:?})")
|
||||
}
|
||||
Self::CheckCycle(arg0, arg1) => {
|
||||
write!(f, "CheckCycle({:?}, {:?})", arg0, arg1)
|
||||
write!(f, "CheckCycle({arg0:?}, {arg1:?})")
|
||||
}
|
||||
Self::IngestedFile(arg0, arg1, arg2) => {
|
||||
write!(f, "IngestedFile({:?}, {:?}, {:?})", arg0, arg1, arg2)
|
||||
write!(f, "IngestedFile({arg0:?}, {arg1:?}, {arg2:?})")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ trait CopyEnv {
|
|||
if descriptor.copy.into_variable().is_some() {
|
||||
descriptor.copy = OptVariable::NONE;
|
||||
} else {
|
||||
debug_assert!(false, "{:?} marked as copied but it wasn't", var);
|
||||
debug_assert!(false, "{var:?} marked as copied but it wasn't");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ mod test {
|
|||
FlexVar(Some(name)) => {
|
||||
assert_eq!(subs[*name].as_str(), "a");
|
||||
}
|
||||
it => panic!("{:?}", it),
|
||||
it => panic!("{it:?}"),
|
||||
}
|
||||
assert_eq!(var, variant_var);
|
||||
assert!(matches!(
|
||||
|
@ -1337,7 +1337,7 @@ mod test {
|
|||
FlexVar(Some(name)) => {
|
||||
assert_eq!(subs[*name].as_str(), "b");
|
||||
}
|
||||
it => panic!("{:?}", it),
|
||||
it => panic!("{it:?}"),
|
||||
}
|
||||
|
||||
match arg.value {
|
||||
|
@ -1355,10 +1355,10 @@ mod test {
|
|||
assert_eq!(name.0.as_str(), "G");
|
||||
assert_eq!(arguments.len(), 0);
|
||||
}
|
||||
e => panic!("{:?}", e),
|
||||
e => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
e => panic!("{:?}", e),
|
||||
e => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ mod test {
|
|||
FlexVar(Some(name)) => {
|
||||
assert_eq!(target[*name].as_str(), "a");
|
||||
}
|
||||
it => panic!("{:?}", it),
|
||||
it => panic!("{it:?}"),
|
||||
}
|
||||
assert_eq!(var, variant_var);
|
||||
assert!(matches!(
|
||||
|
@ -1418,7 +1418,7 @@ mod test {
|
|||
FlexVar(Some(name)) => {
|
||||
assert_eq!(target[*name].as_str(), "b");
|
||||
}
|
||||
it => panic!("{:?}", it),
|
||||
it => panic!("{it:?}"),
|
||||
}
|
||||
|
||||
match arg.value {
|
||||
|
@ -1436,10 +1436,10 @@ mod test {
|
|||
assert_eq!(name.0.as_str(), "G");
|
||||
assert_eq!(arguments.len(), 0);
|
||||
}
|
||||
e => panic!("{:?}", e),
|
||||
e => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
e => panic!("{:?}", e),
|
||||
e => panic!("{e:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,8 +1069,7 @@ fn canonicalize_value_defs<'a>(
|
|||
debug_assert_eq!(env.home, s.module_id());
|
||||
debug_assert!(
|
||||
!symbol_to_index.iter().any(|(id, _)| *id == s.ident_id()),
|
||||
"{:?}",
|
||||
s
|
||||
"{s:?}"
|
||||
);
|
||||
|
||||
symbol_to_index.push((s.ident_id(), def_index as u32));
|
||||
|
@ -1838,7 +1837,7 @@ pub(crate) fn sort_can_defs(
|
|||
);
|
||||
|
||||
let declaration = if def_ordering.references.get_row_col(index, index) {
|
||||
debug_assert!(!is_specialization, "Self-recursive specializations can only be determined during solving - but it was determined for {:?} now, that's a bug!", def);
|
||||
debug_assert!(!is_specialization, "Self-recursive specializations can only be determined during solving - but it was determined for {def:?} now, that's a bug!");
|
||||
|
||||
if is_initial
|
||||
&& !def
|
||||
|
|
|
@ -222,16 +222,16 @@ pub(crate) fn synthesize_member_impl<'a>(
|
|||
ability_member: Symbol,
|
||||
) -> (Symbol, Loc<Pattern>, &'a Loc<ast::Expr<'a>>) {
|
||||
// @Opaq
|
||||
let at_opaque = env.arena.alloc_str(&format!("@{}", opaque_name));
|
||||
let at_opaque = env.arena.alloc_str(&format!("@{opaque_name}"));
|
||||
|
||||
let (impl_name, def_body): (String, ast::Expr<'a>) = match ability_member {
|
||||
Symbol::ENCODE_TO_ENCODER => (
|
||||
format!("#{}_toEncoder", opaque_name),
|
||||
format!("#{opaque_name}_toEncoder"),
|
||||
to_encoder(env, at_opaque),
|
||||
),
|
||||
Symbol::DECODE_DECODER => (format!("#{}_decoder", opaque_name), decoder(env, at_opaque)),
|
||||
Symbol::HASH_HASH => (format!("#{}_hash", opaque_name), hash(env, at_opaque)),
|
||||
Symbol::BOOL_IS_EQ => (format!("#{}_isEq", opaque_name), is_eq(env, at_opaque)),
|
||||
Symbol::DECODE_DECODER => (format!("#{opaque_name}_decoder"), decoder(env, at_opaque)),
|
||||
Symbol::HASH_HASH => (format!("#{opaque_name}_hash"), hash(env, at_opaque)),
|
||||
Symbol::BOOL_IS_EQ => (format!("#{opaque_name}_isEq"), is_eq(env, at_opaque)),
|
||||
other => internal_error!("{:?} is not a derivable ability member!", other),
|
||||
};
|
||||
|
||||
|
|
|
@ -1362,7 +1362,7 @@ pub fn build_host_exposed_def(
|
|||
match typ.shallow_structural_dealias() {
|
||||
Type::Function(args, _, _) => {
|
||||
for i in 0..args.len() {
|
||||
let name = format!("closure_arg_{}_{}", ident, i);
|
||||
let name = format!("closure_arg_{ident}_{i}");
|
||||
|
||||
let arg_symbol = {
|
||||
let ident = name.clone().into();
|
||||
|
@ -1381,7 +1381,7 @@ pub fn build_host_exposed_def(
|
|||
linked_symbol_arguments.push((arg_var, Expr::Var(arg_symbol, arg_var)));
|
||||
}
|
||||
|
||||
let foreign_symbol_name = format!("roc_fx_{}", ident);
|
||||
let foreign_symbol_name = format!("roc_fx_{ident}");
|
||||
let low_level_call = Expr::ForeignCall {
|
||||
foreign_symbol: foreign_symbol_name.into(),
|
||||
args: linked_symbol_arguments,
|
||||
|
@ -1389,7 +1389,7 @@ pub fn build_host_exposed_def(
|
|||
};
|
||||
|
||||
let effect_closure_symbol = {
|
||||
let name = format!("effect_closure_{}", ident);
|
||||
let name = format!("effect_closure_{ident}");
|
||||
|
||||
let ident = name.into();
|
||||
scope.introduce(ident, Region::zero()).unwrap()
|
||||
|
@ -1435,7 +1435,7 @@ pub fn build_host_exposed_def(
|
|||
_ => {
|
||||
// not a function
|
||||
|
||||
let foreign_symbol_name = format!("roc_fx_{}", ident);
|
||||
let foreign_symbol_name = format!("roc_fx_{ident}");
|
||||
let low_level_call = Expr::ForeignCall {
|
||||
foreign_symbol: foreign_symbol_name.into(),
|
||||
args: linked_symbol_arguments,
|
||||
|
@ -1443,7 +1443,7 @@ pub fn build_host_exposed_def(
|
|||
};
|
||||
|
||||
let effect_closure_symbol = {
|
||||
let name = format!("effect_closure_{}", ident);
|
||||
let name = format!("effect_closure_{ident}");
|
||||
|
||||
let ident = name.into();
|
||||
scope.introduce(ident, Region::zero()).unwrap()
|
||||
|
|
|
@ -67,8 +67,7 @@ impl<'a> Env<'a> {
|
|||
) -> Result<Symbol, RuntimeError> {
|
||||
debug_assert!(
|
||||
!module_name_str.is_empty(),
|
||||
"Called env.qualified_lookup with an unqualified ident: {:?}",
|
||||
ident
|
||||
"Called env.qualified_lookup with an unqualified ident: {ident:?}"
|
||||
);
|
||||
|
||||
let module_name = ModuleName::from(module_name_str);
|
||||
|
|
|
@ -347,9 +347,7 @@ pub fn canonicalize_module_defs<'a>(
|
|||
// the symbol should already be added to the scope when this module is canonicalized
|
||||
debug_assert!(
|
||||
scope.contains_alias(symbol) || scope.abilities_store.is_ability(symbol),
|
||||
"The {:?} is not a type alias or ability known in {:?}",
|
||||
symbol,
|
||||
home
|
||||
"The {symbol:?} is not a type alias or ability known in {home:?}"
|
||||
);
|
||||
|
||||
// but now we know this symbol by a different identifier, so we still need to add it to
|
||||
|
|
|
@ -220,8 +220,7 @@ fn from_str_radix(src: &str, radix: u32) -> Result<ParsedNumResult, IntErrorKind
|
|||
|
||||
assert!(
|
||||
(2..=36).contains(&radix),
|
||||
"from_str_radix_int: must lie in the range `[2, 36]` - found {}",
|
||||
radix
|
||||
"from_str_radix_int: must lie in the range `[2, 36]` - found {radix}"
|
||||
);
|
||||
|
||||
let (opt_exact_bound, src) = parse_literal_suffix(src);
|
||||
|
|
|
@ -531,7 +531,7 @@ pub fn canonicalize_pattern<'a>(
|
|||
use std::ops::Neg;
|
||||
|
||||
let sign_str = if is_negative { "-" } else { "" };
|
||||
let int_str = format!("{}{}", sign_str, int).into_boxed_str();
|
||||
let int_str = format!("{sign_str}{int}").into_boxed_str();
|
||||
let i = match int {
|
||||
// Safety: this is fine because I128::MAX = |I128::MIN| - 1
|
||||
IntValue::I128(n) if is_negative => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue