Skip to content

Commit b34ed13

Browse files
authored
fix: clippy (#3806)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent 7913e3c commit b34ed13

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

cprover_bindings/src/irep/goto_binary_serde.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,9 @@ where
936936
}
937937
}
938938

939-
////////////////////////////////////////
940-
//// Dynamic memory usage computation
941-
////////////////////////////////////////
939+
// ==================================
940+
// Dynamic memory usage computation
941+
// ==================================
942942

943943
#[cfg(test)]
944944
mod sharing_stats {
@@ -1032,7 +1032,7 @@ mod sharing_stats {
10321032
}
10331033
}
10341034

1035-
impl<'a, W> DynamicUsage for GotoBinarySerializer<'a, W>
1035+
impl<W> DynamicUsage for GotoBinarySerializer<'_, W>
10361036
where
10371037
W: Write,
10381038
{
@@ -1127,9 +1127,9 @@ mod sharing_stats {
11271127
max_count = *count;
11281128
max_id = Some(id);
11291129
};
1130-
nof_unique = nof_unique + 1;
1130+
nof_unique += 1;
11311131
let incr = (*count as f64 - avg_count) / (nof_unique as f64);
1132-
avg_count = avg_count + incr;
1132+
avg_count += incr;
11331133
}
11341134
SharingStats {
11351135
_nof_unique: nof_unique,
@@ -1156,7 +1156,7 @@ mod sharing_stats {
11561156
}
11571157

11581158
impl GotoBinarySharingStats {
1159-
fn from_serializer<'a, W: Write>(s: &GotoBinarySerializer<'a, W>) -> Self {
1159+
fn from_serializer<W: Write>(s: &GotoBinarySerializer<'_, W>) -> Self {
11601160
GotoBinarySharingStats {
11611161
_allocated_bytes: s.dynamic_usage(),
11621162
_string_stats: SharingStats::new(&s.string_count),
@@ -1173,7 +1173,7 @@ mod sharing_stats {
11731173
}
11741174
}
11751175

1176-
impl<'a, W> GotoBinarySerializer<'a, W>
1176+
impl<W> GotoBinarySerializer<'_, W>
11771177
where
11781178
W: Write,
11791179
{
@@ -1277,13 +1277,13 @@ mod tests {
12771277
let mut writer = BufWriter::new(&mut vec);
12781278
let mut serializer = GotoBinarySerializer::new(&mut writer);
12791279

1280-
for u in std::u8::MIN..std::u8::MAX {
1280+
for u in u8::MIN..u8::MAX {
12811281
serializer.write_u8(u);
12821282
}
12831283
}
12841284

12851285
// read back from byte stream
1286-
for u in std::u8::MIN..std::u8::MAX {
1286+
for u in u8::MIN..u8::MAX {
12871287
assert_eq!(vec[u as usize], u);
12881288
}
12891289
}
@@ -1352,7 +1352,7 @@ mod tests {
13521352
let foo = String::from("foo").intern();
13531353
let bar = String::from("bar").intern();
13541354
let baz = String::from("baz").intern();
1355-
let strings = vec![foo, bar, foo, bar, foo, baz, baz, bar, foo];
1355+
let strings = [foo, bar, foo, bar, foo, baz, baz, bar, foo];
13561356

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

cprover_bindings/src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ mod tests {
106106
use num::BigInt;
107107

108108
#[test]
109+
#[allow(clippy::bool_assert_comparison)]
109110
fn test_fits_in_bits() {
110111
assert_eq!(BigInt::from(10).fits_in_bits(3, false), false);
111112
assert_eq!(BigInt::from(10).fits_in_bits(4, false), true);

kani_metadata/src/artifact.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ mod test {
9999

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

@@ -109,7 +109,7 @@ mod test {
109109

110110
#[test]
111111
fn test_set_extension_ok() {
112-
let path = PathBuf::from("/tmp/my_file.rs").with_extension(&SymTabGoto);
112+
let path = PathBuf::from("/tmp/my_file.rs").with_extension(SymTabGoto);
113113
assert_eq!(path.as_os_str(), "/tmp/my_file.symtab.out");
114114
}
115115
}

library/kani/src/models/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ mod test {
191191
u64: From<M>,
192192
{
193193
assert_eq!(
194-
unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, M, E, LANES>(mask.clone())) },
194+
unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, M, E, LANES>(mask)) },
195195
mask.to_bitmask()
196196
);
197197
}
@@ -220,8 +220,7 @@ mod test {
220220
let bitmask = mask.to_bitmask();
221221
assert_eq!(bitmask, 0b1010);
222222

223-
let kani_mask =
224-
unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, u8, u32, 4>(mask.clone())) };
223+
let kani_mask = unsafe { u64::from(kani_intrinsic::simd_bitmask::<_, u8, u32, 4>(mask)) };
225224
assert_eq!(kani_mask, bitmask);
226225
}
227226
}

0 commit comments

Comments
 (0)