Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clippy #3806

Merged
merged 1 commit into from
Jan 2, 2025
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
22 changes: 11 additions & 11 deletions cprover_bindings/src/irep/goto_binary_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,9 @@ where
}
}

////////////////////////////////////////
//// Dynamic memory usage computation
////////////////////////////////////////
// ==================================
// Dynamic memory usage computation
// ==================================

#[cfg(test)]
mod sharing_stats {
Expand Down Expand Up @@ -1032,7 +1032,7 @@ mod sharing_stats {
}
}

impl<'a, W> DynamicUsage for GotoBinarySerializer<'a, W>
impl<W> DynamicUsage for GotoBinarySerializer<'_, W>
where
W: Write,
{
Expand Down Expand Up @@ -1127,9 +1127,9 @@ mod sharing_stats {
max_count = *count;
max_id = Some(id);
};
nof_unique = nof_unique + 1;
nof_unique += 1;
let incr = (*count as f64 - avg_count) / (nof_unique as f64);
avg_count = avg_count + incr;
avg_count += incr;
}
SharingStats {
_nof_unique: nof_unique,
Expand All @@ -1156,7 +1156,7 @@ mod sharing_stats {
}

impl GotoBinarySharingStats {
fn from_serializer<'a, W: Write>(s: &GotoBinarySerializer<'a, W>) -> Self {
fn from_serializer<W: Write>(s: &GotoBinarySerializer<'_, W>) -> Self {
GotoBinarySharingStats {
_allocated_bytes: s.dynamic_usage(),
_string_stats: SharingStats::new(&s.string_count),
Expand All @@ -1173,7 +1173,7 @@ mod sharing_stats {
}
}

impl<'a, W> GotoBinarySerializer<'a, W>
impl<W> GotoBinarySerializer<'_, W>
where
W: Write,
{
Expand Down Expand Up @@ -1277,13 +1277,13 @@ mod tests {
let mut writer = BufWriter::new(&mut vec);
let mut serializer = GotoBinarySerializer::new(&mut writer);

for u in std::u8::MIN..std::u8::MAX {
for u in u8::MIN..u8::MAX {
serializer.write_u8(u);
}
}

// read back from byte stream
for u in std::u8::MIN..std::u8::MAX {
for u in u8::MIN..u8::MAX {
assert_eq!(vec[u as usize], u);
}
}
Expand Down Expand Up @@ -1352,7 +1352,7 @@ mod tests {
let foo = String::from("foo").intern();
let bar = String::from("bar").intern();
let baz = String::from("baz").intern();
let strings = vec![foo, bar, foo, bar, foo, baz, baz, bar, foo];
let strings = [foo, bar, foo, bar, foo, baz, baz, bar, foo];

let mut vec: Vec<u8> = Vec::new();

Expand Down
1 change: 1 addition & 0 deletions cprover_bindings/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ mod tests {
use num::BigInt;

#[test]
#[allow(clippy::bool_assert_comparison)]
fn test_fits_in_bits() {
assert_eq!(BigInt::from(10).fits_in_bits(3, false), false);
assert_eq!(BigInt::from(10).fits_in_bits(4, false), true);
Expand Down
4 changes: 2 additions & 2 deletions kani_metadata/src/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ mod test {

#[test]
fn test_convert_ok() {
let path = PathBuf::from("/tmp/my_file.rs").with_extension(&SymTabGoto);
let path = PathBuf::from("/tmp/my_file.rs").with_extension(SymTabGoto);
let goto = convert_type(&path, SymTabGoto, Goto);
assert_eq!(goto.as_os_str(), "/tmp/my_file.out");

Expand All @@ -109,7 +109,7 @@ mod test {

#[test]
fn test_set_extension_ok() {
let path = PathBuf::from("/tmp/my_file.rs").with_extension(&SymTabGoto);
let path = PathBuf::from("/tmp/my_file.rs").with_extension(SymTabGoto);
assert_eq!(path.as_os_str(), "/tmp/my_file.symtab.out");
}
}
5 changes: 2 additions & 3 deletions library/kani/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ mod test {
u64: From<M>,
{
assert_eq!(
unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, M, E, LANES>(mask.clone())) },
unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, M, E, LANES>(mask)) },
mask.to_bitmask()
);
}
Expand Down Expand Up @@ -220,8 +220,7 @@ mod test {
let bitmask = mask.to_bitmask();
assert_eq!(bitmask, 0b1010);

let kani_mask =
unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, u8, u32, 4>(mask.clone())) };
let kani_mask = unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, u8, u32, 4>(mask)) };
assert_eq!(kani_mask, bitmask);
}
}
Loading