Skip to content

Commit 8c87854

Browse files
kxxtalindima
authored andcommitted
Fix clippy warnings
Signed-off-by: Levi Zim <[email protected]>
1 parent 39091a7 commit 8c87854

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

src/backend/condition.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,8 @@ mod tests {
338338
};
339339
let data_ptr = (&data as *const libc::seccomp_data) as *const u32;
340340

341-
assert_eq!(
342-
unsafe { *(data_ptr.offset((lsb_offset / 4) as isize) as *const u32) },
343-
0
344-
);
345-
assert_eq!(
346-
unsafe { *(data_ptr.offset((msb_offset / 4) as isize) as *const u32) },
347-
1
348-
);
341+
assert_eq!(unsafe { *data_ptr.offset((lsb_offset / 4) as isize) }, 0);
342+
assert_eq!(unsafe { *data_ptr.offset((msb_offset / 4) as isize) }, 1);
349343
}
350344

351345
#[test]

src/backend/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ mod tests {
297297
for _ in 1..1000 {
298298
rules
299299
.entry(1)
300-
.or_insert_with(std::vec::Vec::new)
300+
.or_default()
301301
.append(&mut vec![SeccompRule::new(vec![Cond::new(
302302
2,
303303
ArgLen::Dword,

src/frontend/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl JsonCompiler {
237237
.syscall_table
238238
.get_syscall_nr(&syscall_name)
239239
.ok_or_else(|| Error::SyscallName(syscall_name.clone(), self.arch))?;
240-
let rule_accumulator = rule_map.entry(syscall_nr).or_insert_with(Vec::new);
240+
let rule_accumulator = rule_map.entry(syscall_nr).or_default();
241241

242242
if let Some(conditions) = json_rule.conditions {
243243
let mut seccomp_conditions = Vec::with_capacity(conditions.len());

tests/integration_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn validate_seccomp_filter(rules: Vec<(i64, Vec<SeccompRule>)>, validation_fn: f
5050

5151
// Make sure the extra needed syscalls are allowed
5252
for syscall in EXTRA_SYSCALLS.iter() {
53-
rule_map.entry(*syscall).or_insert_with(Vec::new);
53+
rule_map.entry(*syscall).or_default();
5454
}
5555

5656
// Build seccomp filter.

0 commit comments

Comments
 (0)