Skip to content

Commit

Permalink
Fixed some clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Mar 2, 2022
1 parent b563353 commit 48ca2b2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ impl<R: io::BufRead> Reader<R> {
false)?;

Ok(Some(CanDumpRecord {
t_us: t_us,
device: device,
frame: frame,
t_us,
device,
frame,
}))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{
fn get_data(frame: &CanFrame, idx: u8) -> Result<u8, CanErrorDecodingFailure> {
Ok(*(frame.data()
.get(idx as usize)
.ok_or_else(|| CanErrorDecodingFailure::NotEnoughData(idx)))?)
.ok_or(CanErrorDecodingFailure::NotEnoughData(idx)))?)
}


Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
//!

// clippy: do not warn about things like "SocketCAN" inside the docs
#![cfg_attr(feature = "cargo-clippy", allow(doc_markdown))]
#![allow(clippy::doc_markdown)]

mod err;
pub use err::{CanError, CanErrorDecodingFailure, CanSocketOpenError, ConstructionError};
Expand Down Expand Up @@ -184,7 +184,7 @@ pub const ERR_MASK_NONE: u32 = 0;
fn c_timeval_new(t: time::Duration) -> timeval {
timeval {
tv_sec: t.as_secs() as time_t,
tv_usec: (t.subsec_nanos() / 1000) as suseconds_t,
tv_usec: t.subsec_micros() as suseconds_t,
}
}

Expand Down Expand Up @@ -445,7 +445,7 @@ impl AsRawFd for CanSocket {

impl FromRawFd for CanSocket {
unsafe fn from_raw_fd(fd: RawFd) -> CanSocket {
CanSocket { fd: fd }
CanSocket { fd, }
}
}

Expand Down Expand Up @@ -521,7 +521,7 @@ impl CanFrame {
}

Ok(CanFrame {
_id: _id,
_id,
_data_len: data.len() as u8,
_pad: 0,
_res0: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn set_socket_option_mult<T>(fd: c_int,
values: &[T])
-> io::Result<()> {

let rv = if values.len() < 1 {
let rv = if values.is_empty() {
// can't pass in a pointer to the first element if a 0-length slice,
// pass a nullpointer instead
unsafe { setsockopt(fd, level, name, ptr::null(), 0) }
Expand Down

0 comments on commit 48ca2b2

Please sign in to comment.