Fix some clippy warnings (#536)
This commit is contained in:
committed by
Dan Gohman
parent
ef1cbfdaa8
commit
3206461502
@@ -39,11 +39,13 @@ lazy_static! {
|
||||
.map_err(|_| warn!("Failed to get metadata of current executable"))
|
||||
.ok()
|
||||
})
|
||||
.map(|mtime| match mtime.duration_since(std::time::UNIX_EPOCH) {
|
||||
Ok(duration) => format!("{}", duration.as_millis()),
|
||||
Err(err) => format!("m{}", err.duration().as_millis()),
|
||||
})
|
||||
.unwrap_or_else(|| "no-mtime".to_string())
|
||||
.map_or_else(
|
||||
|| "no-mtime".to_string(),
|
||||
|mtime| match mtime.duration_since(std::time::UNIX_EPOCH) {
|
||||
Ok(duration) => format!("{}", duration.as_millis()),
|
||||
Err(err) => format!("m{}", err.duration().as_millis()),
|
||||
},
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
allow(clippy::new_without_default, clippy::new_without_default_derive)
|
||||
allow(clippy::new_without_default, clippy::new_without_default)
|
||||
)]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
allow(clippy::new_without_default, clippy::new_without_default_derive)
|
||||
allow(clippy::new_without_default, clippy::new_without_default)
|
||||
)]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
allow(clippy::new_without_default, clippy::new_without_default_derive)
|
||||
allow(clippy::new_without_default, clippy::new_without_default)
|
||||
)]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
|
||||
@@ -15,12 +15,12 @@ enum PendingFdEntry {
|
||||
impl std::fmt::Debug for PendingFdEntry {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
PendingFdEntry::Thunk(f) => write!(
|
||||
Self::Thunk(f) => write!(
|
||||
fmt,
|
||||
"PendingFdEntry::Thunk({:p})",
|
||||
f as *const fn() -> Result<FdEntry>
|
||||
),
|
||||
PendingFdEntry::File(f) => write!(fmt, "PendingFdEntry::File({:?})", f),
|
||||
Self::File(f) => write!(fmt, "PendingFdEntry::File({:?})", f),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,8 +46,8 @@ impl From<OsString> for PendingCString {
|
||||
impl PendingCString {
|
||||
fn into_string(self) -> Result<String> {
|
||||
match self {
|
||||
PendingCString::Bytes(v) => String::from_utf8(v).map_err(|_| Error::EILSEQ),
|
||||
PendingCString::OsString(s) => s.into_string().map_err(|_| Error::EILSEQ),
|
||||
Self::Bytes(v) => String::from_utf8(v).map_err(|_| Error::EILSEQ),
|
||||
Self::OsString(s) => s.into_string().map_err(|_| Error::EILSEQ),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// missing_docs,
|
||||
trivial_numeric_casts,
|
||||
unused_extern_crates,
|
||||
unstable_features
|
||||
unstable_features,
|
||||
clippy::use_self
|
||||
)]
|
||||
#![warn(unused_import_braces)]
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../clippy.toml")))]
|
||||
|
||||
Reference in New Issue
Block a user