mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
auto clippy fixes
This commit is contained in:
parent
72c85efc83
commit
ef39bad7c6
146 changed files with 750 additions and 1005 deletions
|
@ -820,7 +820,7 @@ fn write_content<'a>(
|
|||
"".to_string()
|
||||
};
|
||||
if env.home == symbol.module_id() {
|
||||
format!("{}{}", ident_str, disambiguation,)
|
||||
format!("{ident_str}{disambiguation}",)
|
||||
} else {
|
||||
format!(
|
||||
"{}.{}{}",
|
||||
|
|
|
@ -774,11 +774,11 @@ impl fmt::Debug for Subs {
|
|||
let root = self.get_root_key_without_compacting(var);
|
||||
|
||||
if var == root {
|
||||
write!(f, "{} => ", i)?;
|
||||
write!(f, "{i} => ")?;
|
||||
|
||||
subs_fmt_desc(&desc, self, f)?;
|
||||
} else {
|
||||
write!(f, "{} => <{:?}>", i, root)?;
|
||||
write!(f, "{i} => <{root:?}>")?;
|
||||
}
|
||||
|
||||
writeln!(f)?;
|
||||
|
@ -811,7 +811,7 @@ fn subs_fmt_content(this: &Content, subs: &Subs, f: &mut fmt::Formatter) -> fmt:
|
|||
Some(index) => subs[*index].as_str(),
|
||||
None => "_",
|
||||
};
|
||||
write!(f, "Flex({})", name)
|
||||
write!(f, "Flex({name})")
|
||||
}
|
||||
Content::FlexAbleVar(name, symbols) => {
|
||||
let name = match name {
|
||||
|
@ -827,7 +827,7 @@ fn subs_fmt_content(this: &Content, subs: &Subs, f: &mut fmt::Formatter) -> fmt:
|
|||
Content::RecursionVar {
|
||||
structure,
|
||||
opt_name,
|
||||
} => write!(f, "Recursion({:?}, {:?})", structure, opt_name),
|
||||
} => write!(f, "Recursion({structure:?}, {opt_name:?})"),
|
||||
Content::Structure(flat_type) => subs_fmt_flat_type(flat_type, subs, f),
|
||||
Content::Alias(name, arguments, actual, kind) => {
|
||||
let slice = subs.get_subs_slice(arguments.all_variables());
|
||||
|
@ -855,7 +855,7 @@ fn subs_fmt_content(this: &Content, subs: &Subs, f: &mut fmt::Formatter) -> fmt:
|
|||
write!(f, "LambdaSet([")?;
|
||||
|
||||
for (name, slice) in solved.iter_from_subs(subs) {
|
||||
write!(f, "{:?} ", name)?;
|
||||
write!(f, "{name:?} ")?;
|
||||
for var in slice {
|
||||
write!(
|
||||
f,
|
||||
|
@ -869,7 +869,7 @@ fn subs_fmt_content(this: &Content, subs: &Subs, f: &mut fmt::Formatter) -> fmt:
|
|||
|
||||
write!(f, "]")?;
|
||||
if let Some(rec_var) = recursion_var.into_variable() {
|
||||
write!(f, " as <{:?}>", rec_var)?;
|
||||
write!(f, " as <{rec_var:?}>")?;
|
||||
}
|
||||
for Uls(var, member, region) in subs.get_subs_slice(*unspecialized) {
|
||||
write!(
|
||||
|
@ -881,10 +881,10 @@ fn subs_fmt_content(this: &Content, subs: &Subs, f: &mut fmt::Formatter) -> fmt:
|
|||
region
|
||||
)?;
|
||||
}
|
||||
write!(f, ", ^<{:?}>)", ambient_function_var)
|
||||
write!(f, ", ^<{ambient_function_var:?}>)")
|
||||
}
|
||||
Content::RangedNumber(range) => {
|
||||
write!(f, "RangedNumber( {:?})", range)
|
||||
write!(f, "RangedNumber( {range:?})")
|
||||
}
|
||||
Content::Error => write!(f, "Error"),
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ fn subs_fmt_flat_type(this: &FlatType, subs: &Subs, f: &mut fmt::Formatter) -> f
|
|||
FlatType::Apply(name, arguments) => {
|
||||
let slice = subs.get_subs_slice(*arguments);
|
||||
|
||||
write!(f, "Apply({:?}, {:?})", name, slice)
|
||||
write!(f, "Apply({name:?}, {slice:?})")
|
||||
}
|
||||
FlatType::Func(arguments, lambda_set, result) => {
|
||||
let slice = subs.get_subs_slice(*arguments);
|
||||
|
@ -948,7 +948,7 @@ fn subs_fmt_flat_type(this: &FlatType, subs: &Subs, f: &mut fmt::Formatter) -> f
|
|||
)?;
|
||||
}
|
||||
|
||||
write!(f, "}}<{:?}>", new_ext)
|
||||
write!(f, "}}<{new_ext:?}>")
|
||||
}
|
||||
FlatType::Tuple(elems, ext) => {
|
||||
write!(f, "( ")?;
|
||||
|
@ -962,14 +962,14 @@ fn subs_fmt_flat_type(this: &FlatType, subs: &Subs, f: &mut fmt::Formatter) -> f
|
|||
)?;
|
||||
}
|
||||
|
||||
write!(f, ")<{:?}>", new_ext)
|
||||
write!(f, ")<{new_ext:?}>")
|
||||
}
|
||||
FlatType::TagUnion(tags, ext) => {
|
||||
write!(f, "[")?;
|
||||
|
||||
let (it, new_ext) = tags.sorted_iterator_and_ext(subs, *ext);
|
||||
for (name, slice) in it {
|
||||
write!(f, "{:?} ", name)?;
|
||||
write!(f, "{name:?} ")?;
|
||||
for var in slice {
|
||||
write!(
|
||||
f,
|
||||
|
@ -981,26 +981,22 @@ fn subs_fmt_flat_type(this: &FlatType, subs: &Subs, f: &mut fmt::Formatter) -> f
|
|||
write!(f, ", ")?;
|
||||
}
|
||||
|
||||
write!(f, "]<{:?}>", new_ext)
|
||||
write!(f, "]<{new_ext:?}>")
|
||||
}
|
||||
FlatType::FunctionOrTagUnion(tagnames, symbol, ext) => {
|
||||
let tagnames: &[TagName] = subs.get_subs_slice(*tagnames);
|
||||
|
||||
write!(
|
||||
f,
|
||||
"FunctionOrTagUnion({:?}, {:?}, {:?})",
|
||||
tagnames, symbol, ext
|
||||
)
|
||||
write!(f, "FunctionOrTagUnion({tagnames:?}, {symbol:?}, {ext:?})")
|
||||
}
|
||||
FlatType::RecursiveTagUnion(rec, tags, ext) => {
|
||||
write!(f, "[")?;
|
||||
|
||||
let (it, new_ext) = tags.sorted_iterator_and_ext(subs, *ext);
|
||||
for (name, slice) in it {
|
||||
write!(f, "{:?} {:?}, ", name, slice)?;
|
||||
write!(f, "{name:?} {slice:?}, ")?;
|
||||
}
|
||||
|
||||
write!(f, "]<{:?}> as <{:?}>", new_ext, rec)
|
||||
write!(f, "]<{new_ext:?}> as <{rec:?}>")
|
||||
}
|
||||
FlatType::EmptyRecord => write!(f, "EmptyRecord"),
|
||||
FlatType::EmptyTuple => write!(f, "EmptyTuple"),
|
||||
|
@ -1016,7 +1012,7 @@ impl std::fmt::Debug for DebugUtable<'_> {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str("UnificationTable {\n")?;
|
||||
for v in 0..self.0.utable.len() {
|
||||
f.write_fmt(format_args!(" {} => ", v))?;
|
||||
f.write_fmt(format_args!(" {v} => "))?;
|
||||
let var = unsafe { Variable::from_index(v as u32) };
|
||||
let root = self.0.utable.root_key_without_compacting(var);
|
||||
if root == var {
|
||||
|
@ -2820,9 +2816,7 @@ where
|
|||
debug_assert_eq!(
|
||||
labels.len(),
|
||||
variables.len(),
|
||||
"tag name len != variables len: {:?} {:?}",
|
||||
labels,
|
||||
variables,
|
||||
"tag name len != variables len: {labels:?} {variables:?}",
|
||||
);
|
||||
|
||||
Self {
|
||||
|
@ -4025,7 +4019,7 @@ where
|
|||
} else {
|
||||
// TODO is this the proper use of index here, or should we be
|
||||
// doing something else like turning it into an ASCII letter?
|
||||
Lowercase::from(format!("{}{}", given_name, index))
|
||||
Lowercase::from(format!("{given_name}{index}"))
|
||||
};
|
||||
|
||||
match taken_names.get(&indexed_name) {
|
||||
|
@ -4335,7 +4329,7 @@ fn flat_type_to_err_type(
|
|||
ErrorType::Error => ErrorType::Record(err_fields, TypeExt::Closed),
|
||||
|
||||
other =>
|
||||
panic!("Tried to convert a record extension to an error, but the record extension had the ErrorType of {:?}", other)
|
||||
panic!("Tried to convert a record extension to an error, but the record extension had the ErrorType of {other:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4367,7 +4361,7 @@ fn flat_type_to_err_type(
|
|||
ErrorType::Error => ErrorType::Tuple(err_elems, TypeExt::Closed),
|
||||
|
||||
other =>
|
||||
panic!("Tried to convert a record extension to an error, but the record extension had the ErrorType of {:?}", other)
|
||||
panic!("Tried to convert a record extension to an error, but the record extension had the ErrorType of {other:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4393,7 +4387,7 @@ fn flat_type_to_err_type(
|
|||
ErrorType::Error => ErrorType::TagUnion(err_tags, TypeExt::Closed, pol),
|
||||
|
||||
other =>
|
||||
panic!("Tried to convert a tag union extension to an error, but the tag union extension had the ErrorType of {:?}", other)
|
||||
panic!("Tried to convert a tag union extension to an error, but the tag union extension had the ErrorType of {other:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4423,7 +4417,7 @@ fn flat_type_to_err_type(
|
|||
ErrorType::Error => ErrorType::TagUnion(err_tags, TypeExt::Closed, pol),
|
||||
|
||||
other =>
|
||||
panic!("Tried to convert a tag union extension to an error, but the tag union extension had the ErrorType of {:?}", other)
|
||||
panic!("Tried to convert a tag union extension to an error, but the tag union extension had the ErrorType of {other:?}")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4455,7 +4449,7 @@ fn flat_type_to_err_type(
|
|||
ErrorType::Error => ErrorType::RecursiveTagUnion(rec_error_type, err_tags, TypeExt::Closed, pol),
|
||||
|
||||
other =>
|
||||
panic!("Tried to convert a recursive tag union extension to an error, but the tag union extension had the ErrorType of {:?}", other)
|
||||
panic!("Tried to convert a recursive tag union extension to an error, but the tag union extension had the ErrorType of {other:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,11 +55,11 @@ impl<T: fmt::Debug> fmt::Debug for RecordField<T> {
|
|||
use RecordField::*;
|
||||
|
||||
match self {
|
||||
Optional(typ) => write!(f, "Optional({:?})", typ),
|
||||
Required(typ) => write!(f, "Required({:?})", typ),
|
||||
Demanded(typ) => write!(f, "Demanded({:?})", typ),
|
||||
RigidRequired(typ) => write!(f, "RigidRequired({:?})", typ),
|
||||
RigidOptional(typ) => write!(f, "RigidOptional({:?})", typ),
|
||||
Optional(typ) => write!(f, "Optional({typ:?})"),
|
||||
Required(typ) => write!(f, "Required({typ:?})"),
|
||||
Demanded(typ) => write!(f, "Demanded({typ:?})"),
|
||||
RigidRequired(typ) => write!(f, "RigidRequired({typ:?})"),
|
||||
RigidOptional(typ) => write!(f, "RigidOptional({typ:?})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1949,10 +1949,10 @@ fn write_tags<'a>(
|
|||
|
||||
let mut it = tags.peekable();
|
||||
while let Some((label, arguments)) = it.next() {
|
||||
write!(f, "{:?}", label)?;
|
||||
write!(f, "{label:?}")?;
|
||||
|
||||
for argument in arguments {
|
||||
write!(f, " {:?}", argument)?;
|
||||
write!(f, " {argument:?}")?;
|
||||
}
|
||||
|
||||
if it.peek().is_some() {
|
||||
|
@ -1976,23 +1976,23 @@ impl fmt::Debug for Type {
|
|||
write!(f, ", ")?;
|
||||
}
|
||||
|
||||
write!(f, "{:?}", arg)?;
|
||||
write!(f, "{arg:?}")?;
|
||||
}
|
||||
|
||||
write!(f, " |{:?}|", closure)?;
|
||||
write!(f, " |{closure:?}|")?;
|
||||
write!(f, " -> ")?;
|
||||
|
||||
ret.fmt(f)?;
|
||||
|
||||
write!(f, ")")
|
||||
}
|
||||
Type::Variable(var) => write!(f, "<{:?}>", var),
|
||||
Type::Variable(var) => write!(f, "<{var:?}>"),
|
||||
|
||||
Type::Apply(symbol, args, _) => {
|
||||
write!(f, "({:?}", symbol)?;
|
||||
write!(f, "({symbol:?}")?;
|
||||
|
||||
for arg in args {
|
||||
write!(f, " {:?}", arg)?;
|
||||
write!(f, " {arg:?}")?;
|
||||
}
|
||||
|
||||
write!(f, ")")
|
||||
|
@ -2004,10 +2004,10 @@ impl fmt::Debug for Type {
|
|||
lambda_set_variables,
|
||||
infer_ext_in_output_types,
|
||||
}) => {
|
||||
write!(f, "(DelayedAlias {:?}", symbol)?;
|
||||
write!(f, "(DelayedAlias {symbol:?}")?;
|
||||
|
||||
for arg in type_arguments {
|
||||
write!(f, " {:?}", arg)?;
|
||||
write!(f, " {arg:?}")?;
|
||||
}
|
||||
|
||||
for (lambda_set, greek_letter) in
|
||||
|
@ -2017,7 +2017,7 @@ impl fmt::Debug for Type {
|
|||
}
|
||||
|
||||
for (i, infer_ext) in infer_ext_in_output_types.iter().enumerate() {
|
||||
write!(f, " `{}@{:?}", i, infer_ext)?;
|
||||
write!(f, " `{i}@{infer_ext:?}")?;
|
||||
}
|
||||
|
||||
write!(f, ")")?;
|
||||
|
@ -2032,12 +2032,12 @@ impl fmt::Debug for Type {
|
|||
actual: _actual,
|
||||
..
|
||||
} => {
|
||||
write!(f, "(Alias {:?}", symbol)?;
|
||||
write!(f, "(Alias {symbol:?}")?;
|
||||
|
||||
for arg in type_arguments {
|
||||
write!(f, " {:?}", &arg.typ)?;
|
||||
if let Some(abs) = &arg.opt_abilities {
|
||||
write!(f, ":{:?}", abs)?;
|
||||
write!(f, ":{abs:?}")?;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2048,7 +2048,7 @@ impl fmt::Debug for Type {
|
|||
}
|
||||
|
||||
// Sometimes it's useful to see the expansion of the alias
|
||||
write!(f, "[ but actually {:?} ]", _actual)?;
|
||||
write!(f, "[ but actually {_actual:?} ]")?;
|
||||
|
||||
write!(f, ")")?;
|
||||
|
||||
|
@ -2059,10 +2059,10 @@ impl fmt::Debug for Type {
|
|||
type_arguments: arguments,
|
||||
..
|
||||
} => {
|
||||
write!(f, "HostExposedAlias {:?}", name)?;
|
||||
write!(f, "HostExposedAlias {name:?}")?;
|
||||
|
||||
for arg in arguments {
|
||||
write!(f, " {:?}", arg)?;
|
||||
write!(f, " {arg:?}")?;
|
||||
}
|
||||
|
||||
// Sometimes it's useful to see the expansion of the alias
|
||||
|
@ -2082,13 +2082,11 @@ impl fmt::Debug for Type {
|
|||
for (label, field_type) in fields {
|
||||
match field_type {
|
||||
RecordField::Optional(_) | RecordField::RigidOptional(_) => {
|
||||
write!(f, "{:?} ? {:?}", label, field_type)?
|
||||
write!(f, "{label:?} ? {field_type:?}")?
|
||||
}
|
||||
RecordField::Required(_)
|
||||
| RecordField::Demanded(_)
|
||||
| RecordField::RigidRequired(_) => {
|
||||
write!(f, "{:?} : {:?}", label, field_type)?
|
||||
}
|
||||
| RecordField::RigidRequired(_) => write!(f, "{label:?} : {field_type:?}")?,
|
||||
}
|
||||
|
||||
if any_written_yet {
|
||||
|
@ -2129,7 +2127,7 @@ impl fmt::Debug for Type {
|
|||
let mut any_written_yet = false;
|
||||
|
||||
for (_, field_type) in elems.iter() {
|
||||
write!(f, "{:?}", field_type)?;
|
||||
write!(f, "{field_type:?}")?;
|
||||
|
||||
if any_written_yet {
|
||||
write!(f, ", ")?;
|
||||
|
@ -2179,7 +2177,7 @@ impl fmt::Debug for Type {
|
|||
}
|
||||
Type::FunctionOrTagUnion(tag_name, _, ext) => {
|
||||
write!(f, "[")?;
|
||||
write!(f, "{:?}", tag_name)?;
|
||||
write!(f, "{tag_name:?}")?;
|
||||
write!(f, "]")?;
|
||||
|
||||
match ext {
|
||||
|
@ -2204,9 +2202,9 @@ impl fmt::Debug for Type {
|
|||
} => {
|
||||
write!(f, "ClosureTag(")?;
|
||||
|
||||
write!(f, "{:?}, ", name)?;
|
||||
write!(f, "{name:?}, ")?;
|
||||
for capture in captures {
|
||||
write!(f, "{:?}, ", capture)?;
|
||||
write!(f, "{capture:?}, ")?;
|
||||
}
|
||||
|
||||
write!(f, ")")
|
||||
|
@ -2229,13 +2227,13 @@ impl fmt::Debug for Type {
|
|||
}
|
||||
}?;
|
||||
|
||||
write!(f, " as <{:?}>", rec)
|
||||
write!(f, " as <{rec:?}>")
|
||||
}
|
||||
Type::RangedNumber(range_vars) => {
|
||||
write!(f, "Ranged({:?})", range_vars)
|
||||
write!(f, "Ranged({range_vars:?})")
|
||||
}
|
||||
Type::UnspecializedLambdaSet { unspecialized } => {
|
||||
write!(f, "{:?}", unspecialized)
|
||||
write!(f, "{unspecialized:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4005,7 +4003,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
|||
buf.push('(');
|
||||
}
|
||||
buf.push_str(name.as_str());
|
||||
write!(buf, "has {:?}", symbol).unwrap();
|
||||
write!(buf, "has {symbol:?}").unwrap();
|
||||
if write_parens {
|
||||
buf.push(')');
|
||||
}
|
||||
|
@ -4016,7 +4014,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
|||
if write_parens {
|
||||
buf.push('(');
|
||||
}
|
||||
write!(buf, "{:?}", symbol).unwrap();
|
||||
write!(buf, "{symbol:?}").unwrap();
|
||||
|
||||
for arg in arguments {
|
||||
buf.push(' ');
|
||||
|
@ -4061,7 +4059,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
|||
if write_parens {
|
||||
buf.push('(');
|
||||
}
|
||||
write!(buf, "{:?}", symbol).unwrap();
|
||||
write!(buf, "{symbol:?}").unwrap();
|
||||
|
||||
for arg in arguments {
|
||||
buf.push(' ');
|
||||
|
@ -4146,7 +4144,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
|||
let mut it = tags.into_iter().peekable();
|
||||
|
||||
while let Some((tag, args)) = it.next() {
|
||||
write!(buf, "{:?}", tag).unwrap();
|
||||
write!(buf, "{tag:?}").unwrap();
|
||||
for arg in args {
|
||||
buf.push(' ');
|
||||
write_debug_error_type_help(arg, buf, Parens::InTypeParam);
|
||||
|
@ -4165,7 +4163,7 @@ fn write_debug_error_type_help(error_type: ErrorType, buf: &mut String, parens:
|
|||
|
||||
let mut it = tags.into_iter().peekable();
|
||||
while let Some((tag, args)) = it.next() {
|
||||
write!(buf, "{:?}", tag).unwrap();
|
||||
write!(buf, "{tag:?}").unwrap();
|
||||
for arg in args {
|
||||
buf.push(' ');
|
||||
write_debug_error_type_help(arg, buf, Parens::Unnecessary);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue