clippy fixes

This commit is contained in:
Folkert 2022-08-17 14:27:54 +02:00
parent 0ba5b3cfc6
commit f3f6f58d09
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
5 changed files with 6 additions and 11 deletions

View file

@ -55,8 +55,7 @@ fn flatten_directories(files: std::vec::Vec<PathBuf>) -> std::vec::Vec<PathBuf>
}
fn is_roc_file(path: &Path) -> bool {
let ext = path.extension().and_then(OsStr::to_str);
return matches!(ext, Some("roc"));
matches!(path.extension().and_then(OsStr::to_str), Some("roc"))
}
pub fn format(files: std::vec::Vec<PathBuf>, mode: FormatMode) -> Result<(), String> {

View file

@ -114,7 +114,7 @@ pub fn new_assign_mn(
pub fn new_module_name_mn_id(mn_ids: Vec<MarkNodeId>, mark_node_pool: &mut SlowPool) -> MarkNodeId {
if mn_ids.len() == 1 {
*mn_ids.get(0).unwrap() // safe because we checked the length before
*mn_ids.first().unwrap() // safe because we checked the length before
} else {
let nested_node = make_nested_mn(mn_ids, 0);
mark_node_pool.add(nested_node)

View file

@ -162,7 +162,7 @@ macro_rules! run_jit_function_dynamic_type {
// first field is a char pointer (to the error message)
// read value, and transmute to a pointer
let ptr_as_int = *(result as *const u64).offset(1);
let ptr = std::mem::transmute::<u64, *mut c_char>(ptr_as_int);
let ptr = ptr_as_int as *mut c_char;
// make CString (null-terminated)
let raw = CString::from_raw(ptr);

View file

@ -1967,7 +1967,7 @@ pub fn surgery(
let out_gen_start = Instant::now();
let mut offset = 0;
let output = match target.binary_format {
match target.binary_format {
target_lexicon::BinaryFormat::Elf => {
surgery_elf(verbose, &md, &mut exec_mmap, &mut offset, app_obj)
}
@ -2036,8 +2036,6 @@ pub fn surgery(
);
report_timing("Total", total_duration);
}
output
}
#[allow(clippy::too_many_arguments)]

View file

@ -55,7 +55,7 @@ pub fn get_values<'a>(
captures_niche: CapturesNiche::no_niche(),
};
let element = jit_to_ast(
jit_to_ast(
arena,
app,
"expect_repl_main_fn",
@ -64,9 +64,7 @@ pub fn get_values<'a>(
subs,
interns,
target_info,
)?;
element
)?
};
result.push(expr);