Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions crates/intrinsic-test/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
//! We don't need perfect formatting for the generated tests, but simple indentation can make
//! debugging a lot easier.

#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default)]
pub struct Indentation(u32);

impl std::default::Default for Indentation {
fn default() -> Self {
Self(0)
}
}

impl Indentation {
pub fn nested(self) -> Self {
Self(self.0 + 1)
Expand Down
2 changes: 1 addition & 1 deletion crates/intrinsic-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ fn main() {
let args: Cli = clap::Parser::parse();

let filename = args.input;
let c_runner = args.runner.unwrap_or_else(String::new);
let c_runner = args.runner.unwrap_or_default();
let skip = if let Some(filename) = args.skip {
let data = std::fs::read_to_string(&filename).expect("Failed to open file");
data.lines()
Expand Down
8 changes: 4 additions & 4 deletions crates/intrinsic-test/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ impl IntrinsicType {
match *self {
IntrinsicType::Type {
kind,
bit_len: Some(bit_len),
bit_len: Some(8),
..
} if bit_len == 8 => match kind {
} => match kind {
TypeKind::Int => "(int)",
TypeKind::UInt => "(unsigned int)",
TypeKind::Poly => "(unsigned int)(uint8_t)",
Expand Down Expand Up @@ -318,8 +318,8 @@ impl IntrinsicType {
..
} => {
let (prefix, suffix) = match language {
&Language::Rust => ("[", "]"),
&Language::C => ("{", "}"),
Language::Rust => ("[", "]"),
Language::C => ("{", "}"),
};
let body_indentation = indentation.nested();
format!(
Expand Down
2 changes: 1 addition & 1 deletion crates/intrinsic-test/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn value_for_array(bits: u32, index: u32) -> u64 {
8 => VALUES_8[index % VALUES_8.len()].into(),
16 => VALUES_16[index % VALUES_16.len()].into(),
32 => VALUES_32[index % VALUES_32.len()].into(),
64 => VALUES_64[index % VALUES_64.len()].into(),
64 => VALUES_64[index % VALUES_64.len()],
_ => unimplemented!("value_for_array(bits: {bits}, ..)"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/std_detect/src/detect/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ cfg_if::cfg_if! {
fn do_initialize(value: Initializer) {
CACHE[0].initialize((value.0) as usize & Cache::MASK);
CACHE[1].initialize((value.0 >> Cache::CAPACITY) as usize & Cache::MASK);
CACHE[2].initialize((value.0 >> 2 * Cache::CAPACITY) as usize & Cache::MASK);
CACHE[2].initialize((value.0 >> (2 * Cache::CAPACITY)) as usize & Cache::MASK);
}

// We only have to detect features once, and it's fairly costly, so hint to LLVM
Expand Down
4 changes: 2 additions & 2 deletions crates/stdarch-gen-loongarch/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ fn gen_bind_body(
),
_ => panic!("unsupported parameter number"),
};
format!("fn __{}{} {};", current_name, fn_inputs, fn_output)
format!("fn __{current_name}{fn_inputs} {fn_output};")
};
let function = format!(
r#" #[link_name = "llvm.loongarch.{}"]
Expand Down Expand Up @@ -448,7 +448,7 @@ fn gen_bind_body(
};
rustc_legacy_const_generics = "rustc_legacy_const_generics(2, 3)";
}
format!("pub unsafe fn {}{} {}", current_name, fn_inputs, fn_output)
format!("pub unsafe fn {current_name}{fn_inputs} {fn_output}")
};
let mut call_params = {
match para_num {
Expand Down
2 changes: 1 addition & 1 deletion crates/stdarch-test/src/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn parse(output: &str) -> HashSet<Function> {
}
}
match (parts.first(), parts.last()) {
(Some(instr), Some(last_arg)) if is_shll(&instr) && last_arg == "#0" => {
(Some(instr), Some(last_arg)) if is_shll(instr) && last_arg == "#0" => {
assert_eq!(parts.len(), 4);
let mut new_parts = Vec::with_capacity(3);
let new_instr = format!("{}{}{}", &instr[..1], "xtl", &instr[5..]);
Expand Down
5 changes: 1 addition & 4 deletions crates/stdarch-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) {
}

if !found {
panic!(
"failed to find instruction `{}` in the disassembly",
expected
);
panic!("failed to find instruction `{expected}` in the disassembly");
} else if !probably_only_one_instruction {
panic!(
"instruction found, but the disassembly contains too many \
Expand Down
2 changes: 1 addition & 1 deletion crates/stdarch-verify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ fn find_doc(attrs: &[syn::Attribute]) -> String {
}
}
}
return None;
None
})
.collect()
}
Expand Down