mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
auto clippy fixes
This commit is contained in:
parent
72c85efc83
commit
ef39bad7c6
146 changed files with 750 additions and 1005 deletions
|
@ -175,7 +175,7 @@ fn start_phase<'a>(
|
|||
|
||||
match opt_dep_name {
|
||||
None => {
|
||||
panic!("Module {:?} is not in module_cache.module_names", module_id)
|
||||
panic!("Module {module_id:?} is not in module_cache.module_names")
|
||||
}
|
||||
Some(dep_name) => {
|
||||
let module_name = dep_name.clone();
|
||||
|
@ -820,11 +820,11 @@ impl std::fmt::Display for ModuleTiming {
|
|||
let multiple_make_specializations_passes = module_timing.make_specializations.len() > 1;
|
||||
for (i, pass_time) in module_timing.make_specializations.iter().enumerate() {
|
||||
let suffix = if multiple_make_specializations_passes {
|
||||
format!(" (Pass {})", i)
|
||||
format!(" (Pass {i})")
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
report_timing(f, &format!("Make Specializations{}", suffix), *pass_time)?;
|
||||
report_timing(f, &format!("Make Specializations{suffix}"), *pass_time)?;
|
||||
}
|
||||
report_timing(f, "Other", module_timing.other())?;
|
||||
f.write_str("\n")?;
|
||||
|
@ -1866,7 +1866,7 @@ fn worker_task<'a>(
|
|||
">>> {}",
|
||||
match &task {
|
||||
BuildTask::LoadModule { module_name, .. } => {
|
||||
format!("BuildTask::LoadModule({:?})", module_name)
|
||||
format!("BuildTask::LoadModule({module_name:?})")
|
||||
}
|
||||
BuildTask::Parse { header } => {
|
||||
format!("BuildTask::Parse({})", header.module_path.display())
|
||||
|
@ -1879,10 +1879,10 @@ fn worker_task<'a>(
|
|||
format!("BuildTask::Solve({:?})", module.module_id)
|
||||
}
|
||||
BuildTask::BuildPendingSpecializations { module_id, .. } => {
|
||||
format!("BuildTask::BuildPendingSpecializations({:?})", module_id)
|
||||
format!("BuildTask::BuildPendingSpecializations({module_id:?})")
|
||||
}
|
||||
BuildTask::MakeSpecializations { module_id, .. } => {
|
||||
format!("BuildTask::MakeSpecializations({:?})", module_id)
|
||||
format!("BuildTask::MakeSpecializations({module_id:?})")
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -3248,8 +3248,7 @@ fn load_package_from_disk<'a>(
|
|||
},
|
||||
_parse_state,
|
||||
)) => Err(LoadingProblem::UnexpectedHeader(format!(
|
||||
"expected platform/package module, got Interface with header\n{:?}",
|
||||
header
|
||||
"expected platform/package module, got Interface with header\n{header:?}"
|
||||
))),
|
||||
Ok((
|
||||
ast::Module {
|
||||
|
@ -3258,8 +3257,7 @@ fn load_package_from_disk<'a>(
|
|||
},
|
||||
_parse_state,
|
||||
)) => Err(LoadingProblem::UnexpectedHeader(format!(
|
||||
"expected platform/package module, got Hosted module with header\n{:?}",
|
||||
header
|
||||
"expected platform/package module, got Hosted module with header\n{header:?}"
|
||||
))),
|
||||
Ok((
|
||||
ast::Module {
|
||||
|
@ -3268,8 +3266,7 @@ fn load_package_from_disk<'a>(
|
|||
},
|
||||
_parse_state,
|
||||
)) => Err(LoadingProblem::UnexpectedHeader(format!(
|
||||
"expected platform/package module, got App with header\n{:?}",
|
||||
header
|
||||
"expected platform/package module, got App with header\n{header:?}"
|
||||
))),
|
||||
Ok((
|
||||
ast::Module {
|
||||
|
@ -3402,10 +3399,7 @@ fn load_builtin_module_help<'a>(
|
|||
(info, parse_state)
|
||||
}
|
||||
Ok(_) => panic!("invalid header format for builtin module"),
|
||||
Err(e) => panic!(
|
||||
"Hit a parse error in the header of {:?}:\n{:?}",
|
||||
filename, e
|
||||
),
|
||||
Err(e) => panic!("Hit a parse error in the header of {filename:?}:\n{e:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5583,8 +5577,7 @@ fn build_pending_specializations<'a>(
|
|||
}
|
||||
LayoutProblem::UnresolvedTypeVar(v) => {
|
||||
let message = format!(
|
||||
"top level function has unresolved type variable {:?}",
|
||||
v
|
||||
"top level function has unresolved type variable {v:?}"
|
||||
);
|
||||
procs_base
|
||||
.runtime_errors
|
||||
|
@ -5664,8 +5657,7 @@ fn build_pending_specializations<'a>(
|
|||
}
|
||||
LayoutProblem::UnresolvedTypeVar(v) => {
|
||||
let message = format!(
|
||||
"top level function has unresolved type variable {:?}",
|
||||
v
|
||||
"top level function has unresolved type variable {v:?}"
|
||||
);
|
||||
procs_base
|
||||
.runtime_errors
|
||||
|
@ -5702,14 +5694,13 @@ fn build_pending_specializations<'a>(
|
|||
use roc_can::pattern::Pattern;
|
||||
let symbol = match &loc_pattern.value {
|
||||
Pattern::Identifier(_) => {
|
||||
debug_assert!(false, "identifier ended up in Destructure {:?}", symbol);
|
||||
debug_assert!(false, "identifier ended up in Destructure {symbol:?}");
|
||||
symbol
|
||||
}
|
||||
Pattern::AbilityMemberSpecialization { ident, specializes } => {
|
||||
debug_assert!(
|
||||
false,
|
||||
"ability member ended up in Destructure {:?} specializes {:?}",
|
||||
ident, specializes
|
||||
"ability member ended up in Destructure {ident:?} specializes {specializes:?}"
|
||||
);
|
||||
symbol
|
||||
}
|
||||
|
@ -5741,8 +5732,7 @@ fn build_pending_specializations<'a>(
|
|||
}
|
||||
LayoutProblem::UnresolvedTypeVar(v) => {
|
||||
let message = format!(
|
||||
"top level function has unresolved type variable {:?}",
|
||||
v
|
||||
"top level function has unresolved type variable {v:?}"
|
||||
);
|
||||
procs_base
|
||||
.runtime_errors
|
||||
|
@ -5808,8 +5798,7 @@ fn build_pending_specializations<'a>(
|
|||
}
|
||||
LayoutProblem::UnresolvedTypeVar(v) => {
|
||||
let message = format!(
|
||||
"top level function has unresolved type variable {:?}",
|
||||
v
|
||||
"top level function has unresolved type variable {v:?}"
|
||||
);
|
||||
procs_base
|
||||
.runtime_errors
|
||||
|
@ -5881,8 +5870,7 @@ fn build_pending_specializations<'a>(
|
|||
}
|
||||
LayoutProblem::UnresolvedTypeVar(v) => {
|
||||
let message = format!(
|
||||
"top level function has unresolved type variable {:?}",
|
||||
v
|
||||
"top level function has unresolved type variable {v:?}"
|
||||
);
|
||||
procs_base
|
||||
.runtime_errors
|
||||
|
|
|
@ -67,8 +67,7 @@ impl MakeSpecializationsDependents {
|
|||
let entry = self.entry(module_id);
|
||||
debug_assert!(
|
||||
entry.succ.is_empty(),
|
||||
"already added successors for module '{:?}'",
|
||||
module_id
|
||||
"already added successors for module '{module_id:?}'"
|
||||
);
|
||||
|
||||
entry.succ.extend(succ.into_iter());
|
||||
|
@ -516,8 +515,7 @@ impl<'a> Dependencies<'a> {
|
|||
debug_assert_eq!(
|
||||
make_specializations_dependents.0.len(),
|
||||
default_make_specializations_dependents_len,
|
||||
"more modules were added to the graph: {:?}",
|
||||
make_specializations_dependents
|
||||
"more modules were added to the graph: {make_specializations_dependents:?}"
|
||||
);
|
||||
|
||||
output
|
||||
|
@ -567,8 +565,7 @@ impl<'a> Dependencies<'a> {
|
|||
debug_assert_eq!(
|
||||
make_specializations_dependents.0.len(),
|
||||
default_make_specializations_dependents_len,
|
||||
"more modules were added to the graph: {:?}",
|
||||
make_specializations_dependents
|
||||
"more modules were added to the graph: {make_specializations_dependents:?}"
|
||||
);
|
||||
|
||||
output
|
||||
|
|
|
@ -106,9 +106,9 @@ fn multiple_modules(subdir: &str, files: Vec<(&str, &str)>) -> Result<LoadedModu
|
|||
let arena = &arena;
|
||||
|
||||
match multiple_modules_help(subdir, arena, files) {
|
||||
Err(io_error) => panic!("IO trouble: {:?}", io_error),
|
||||
Err(io_error) => panic!("IO trouble: {io_error:?}"),
|
||||
Ok(Err(LoadingProblem::FormattedReport(buf))) => Err(buf),
|
||||
Ok(Err(loading_problem)) => Err(format!("{:?}", loading_problem)),
|
||||
Ok(Err(loading_problem)) => Err(format!("{loading_problem:?}")),
|
||||
Ok(Ok(mut loaded_module)) => {
|
||||
let home = loaded_module.module_id;
|
||||
let (filepath, src) = loaded_module.sources.get(&home).unwrap();
|
||||
|
@ -148,7 +148,7 @@ fn multiple_modules_help<'a>(
|
|||
// Use a deterministic temporary directory.
|
||||
// We can't have all tests use "tmp" because tests run in parallel,
|
||||
// so append the test name to the tmp path.
|
||||
let tmp = format!("tmp/{}", subdir);
|
||||
let tmp = format!("tmp/{subdir}");
|
||||
let dir = roc_test_utils::TmpDir::new(&tmp);
|
||||
|
||||
let app_module = files.pop().unwrap();
|
||||
|
@ -162,7 +162,7 @@ fn multiple_modules_help<'a>(
|
|||
fs::create_dir_all(file_path.parent().unwrap())?;
|
||||
|
||||
let mut file = File::create(file_path)?;
|
||||
writeln!(file, "{}", source)?;
|
||||
writeln!(file, "{source}")?;
|
||||
file_handles.push(file);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ fn multiple_modules_help<'a>(
|
|||
let file_path = dir.path().join(filename);
|
||||
let full_file_path = file_path.clone();
|
||||
let mut file = File::create(file_path)?;
|
||||
writeln!(file, "{}", source)?;
|
||||
writeln!(file, "{source}")?;
|
||||
file_handles.push(file);
|
||||
|
||||
load_and_typecheck(arena, full_file_path, Default::default(), TARGET_INFO)
|
||||
|
@ -188,16 +188,16 @@ fn load_fixture(
|
|||
subs_by_module: ExposedByModule,
|
||||
) -> LoadedModule {
|
||||
let src_dir = fixtures_dir().join(dir_name);
|
||||
let filename = src_dir.join(format!("{}.roc", module_name));
|
||||
let filename = src_dir.join(format!("{module_name}.roc"));
|
||||
let arena = Bump::new();
|
||||
let loaded = load_and_typecheck(&arena, filename, subs_by_module, TARGET_INFO);
|
||||
let mut loaded_module = match loaded {
|
||||
Ok(x) => x,
|
||||
Err(roc_load_internal::file::LoadingProblem::FormattedReport(report)) => {
|
||||
println!("{}", report);
|
||||
println!("{report}");
|
||||
panic!("{}", report);
|
||||
}
|
||||
Err(e) => panic!("{:?}", e),
|
||||
Err(e) => panic!("{e:?}"),
|
||||
};
|
||||
|
||||
let home = loaded_module.module_id;
|
||||
|
@ -258,7 +258,7 @@ fn expect_types(mut loaded_module: LoadedModule, mut expected_types: HashMap<&st
|
|||
let expected_type = expected_types
|
||||
.remove(fully_qualified.as_str())
|
||||
.unwrap_or_else(|| {
|
||||
panic!("Defs included an unexpected symbol: {:?}", fully_qualified)
|
||||
panic!("Defs included an unexpected symbol: {fully_qualified:?}")
|
||||
});
|
||||
|
||||
assert_eq!((&symbol, expected_type), (&symbol, actual_str.as_str()));
|
||||
|
@ -273,7 +273,7 @@ fn expect_types(mut loaded_module: LoadedModule, mut expected_types: HashMap<&st
|
|||
let expected_type = expected_types
|
||||
.remove(fully_qualified.as_str())
|
||||
.unwrap_or_else(|| {
|
||||
panic!("Defs included an unexpected symbol: {:?}", fully_qualified)
|
||||
panic!("Defs included an unexpected symbol: {fully_qualified:?}")
|
||||
});
|
||||
|
||||
assert_eq!((&symbol, expected_type), (&symbol, actual_str.as_str()));
|
||||
|
@ -705,8 +705,7 @@ fn platform_does_not_exist() {
|
|||
// assert!(report.contains("FILE NOT FOUND"), "report=({})", report);
|
||||
assert!(
|
||||
report.contains("zzz-does-not-exist/main.roc"),
|
||||
"report=({})",
|
||||
report
|
||||
"report=({report})"
|
||||
);
|
||||
}
|
||||
Ok(_) => unreachable!("we expect failure here"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue