Skip to content

Commit

Permalink
Fix cargo clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Dec 16, 2022
1 parent 1ad30ac commit 0ee6676
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion commons/zenoh-macros/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{env, ffi::OsString, fs::OpenOptions, io::Write, process::Command};

fn main() {
let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc"));
let output = Command::new(&rustc)
let output = Command::new(rustc)
.arg("-v")
.arg("-V")
.output()
Expand Down
14 changes: 7 additions & 7 deletions commons/zenoh-util/src/time_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,15 @@ fn parse_duration(s: &str) -> Result<f64, ZError> {
}
let mut it = s.bytes().enumerate().rev();
match it.next().unwrap() {
(i, b'u') => s[..i].parse::<f64>().map(|u| U_TO_SECS * u as f64),
(i, b'u') => s[..i].parse::<f64>().map(|u| U_TO_SECS * u),
(_, b's') => match it.next().unwrap() {
(i, b'm') => s[..i].parse::<f64>().map(|ms| MS_TO_SECS * ms as f64),
(i, _) => s[..i + 1].parse::<f64>().map(|sec| sec as f64),
(i, b'm') => s[..i].parse::<f64>().map(|ms| MS_TO_SECS * ms),
(i, _) => s[..i + 1].parse::<f64>(),
},
(i, b'm') => s[..i].parse::<f64>().map(|m| M_TO_SECS * m as f64),
(i, b'h') => s[..i].parse::<f64>().map(|h| H_TO_SECS * h as f64),
(i, b'd') => s[..i].parse::<f64>().map(|d| D_TO_SECS * d as f64),
(i, b'w') => s[..i].parse::<f64>().map(|w| W_TO_SECS * w as f64),
(i, b'm') => s[..i].parse::<f64>().map(|m| M_TO_SECS * m),
(i, b'h') => s[..i].parse::<f64>().map(|h| H_TO_SECS * h),
(i, b'd') => s[..i].parse::<f64>().map(|d| D_TO_SECS * d),
(i, b'w') => s[..i].parse::<f64>().map(|w| W_TO_SECS * w),
_ => s.parse::<f64>(),
}
.map_err(|e| zerror!(r#"Invalid duration "{}" ({})"#, s, e))
Expand Down
4 changes: 2 additions & 2 deletions plugins/zenoh-plugin-storage-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ impl StorageRuntimeInner {
if let Some(storages) = self.storages.remove(&volume.name) {
async_std::task::block_on(futures::future::join_all(
storages
.into_iter()
.map(|(_, s)| async move { s.send(StorageMessage::Stop) }),
.into_values()
.map(|s| async move { s.send(StorageMessage::Stop) }),
));
}
std::mem::drop(self.volumes.remove(&volume.name));
Expand Down
8 changes: 4 additions & 4 deletions zenoh/src/key_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ impl<'a> KeyExpr<'a> {
prefix_len,
session_id,
} if session.id == *session_id => zenoh_protocol_core::WireExpr {
scope: *expr_id as u64,
scope: *expr_id,
suffix: std::borrow::Cow::Borrowed(&key_expr.as_str()[((*prefix_len) as usize)..]),
},
KeyExprInner::BorrowedWire {
Expand All @@ -510,7 +510,7 @@ impl<'a> KeyExpr<'a> {
prefix_len,
session_id,
} if session.id == *session_id => zenoh_protocol_core::WireExpr {
scope: *expr_id as u64,
scope: *expr_id,
suffix: std::borrow::Cow::Borrowed(&key_expr.as_str()[((*prefix_len) as usize)..]),
},
KeyExprInner::Owned(key_expr) | KeyExprInner::Wire { key_expr, .. } => {
Expand Down Expand Up @@ -570,7 +570,7 @@ impl SyncResolve for KeyExprUndeclaration<'_> {
session_id
} if *prefix_len as usize == key_expr.len() => {
if *session_id == session.id {
*expr_id as u64
*expr_id
} else {
return Err(zerror!("Failed to undeclare {}, as it was declared by an other Session", expr).into())
}
Expand All @@ -582,7 +582,7 @@ impl SyncResolve for KeyExprUndeclaration<'_> {
session_id
} if *prefix_len as usize == key_expr.len() => {
if *session_id == session.id {
*expr_id as u64
*expr_id
} else {
return Err(zerror!("Failed to undeclare {}, as it was declared by an other Session", expr).into())
}
Expand Down

0 comments on commit 0ee6676

Please sign in to comment.