Skip to content

Commit

Permalink
more clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
codyps committed Dec 10, 2021
1 parent 3c3205c commit fd79709
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion libsystemd-sys/src/bus/vtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl sd_bus_vtable {
assert!(flags <= ((1 << 56) - 1));

val[0] = typ as u8;
let flags_raw: [u8; 8] = unsafe { transmute(flags) };
let flags_raw = flags.to_ne_bytes();
val[1..(7 + 1)].clone_from_slice(&flags_raw[..7]);

unsafe { transmute(val) }
Expand Down
2 changes: 1 addition & 1 deletion tests/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ fn test_notify() {
.iter(),
);
assert!(result.is_ok());
assert_eq!(result.ok().unwrap(), false); // should fail, since this is not systemd-launched.
assert!(!result.ok().unwrap()); // should fail, since this is not systemd-launched.
}
4 changes: 2 additions & 2 deletions tests/journal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn test_simple_match() {

// seek tail
j.seek(journal::JournalSeek::Tail).unwrap();
journal::send(&[&filter, &msg]);
journal::send(&[&filter, msg]);
j.match_add(key, value).unwrap();
let mut waits = 0;
loop {
Expand Down Expand Up @@ -138,7 +138,7 @@ fn test_simple_match() {
.unwrap()
.match_add("NOKEY", "NOVALUE")
.unwrap();
journal::send(&[&msg]);
journal::send(&[msg]);
while j.next().unwrap() != 0 {
assert!(j.get_data("NO_KEY").unwrap().is_none())
}
Expand Down
24 changes: 9 additions & 15 deletions tests/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn test_get_slice() {
// This is running in a system slice, and perhaps
// in an user one too
true => {
if !ss.is_ok() && !us.is_ok() {
if ss.is_err() && us.is_err() {
panic!("ss: {:?}, us: {:?}", ss, us);
}
}
Expand Down Expand Up @@ -81,14 +81,11 @@ fn test_get_session() {
true => {
// even in this case, we might get a "no data available" (github actions runners return
// this)
match ss {
Err(e) => {
match e.raw_os_error() {
Some(libc::ENODATA) => { /* ok */ }
_ => panic!("{}", e),
}
if let Err(e) = ss {
match e.raw_os_error() {
Some(libc::ENODATA) => { /* ok */ }
_ => panic!("{}", e),
}
_ => { /* ok */ }
}
}
// Nothing meaningful to check here
Expand All @@ -106,14 +103,11 @@ fn test_get_owner_uid() {
true => {
// even in this case, we might get a "no data available" (github actions runners return
// this)
match ou {
Err(e) => {
match e.raw_os_error() {
Some(libc::ENODATA) => { /* ok */ }
_ => panic!("{}", e),
}
if let Err(e) = ou {
match e.raw_os_error() {
Some(libc::ENODATA) => { /* ok */ }
_ => panic!("{}", e),
}
_ => { /* ok */ }
}
}
// Nothing meaningful to check here
Expand Down

0 comments on commit fd79709

Please sign in to comment.