Fix clippy warnings.
This commit fixes the current set of (stable) clippy warnings in the repo.
This commit is contained in:
committed by
Andrew Brown
parent
1176e4f178
commit
9f506692c2
@@ -32,10 +32,7 @@
|
||||
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
|
||||
#![warn(unused_import_braces)]
|
||||
#![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)
|
||||
)]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
warn(
|
||||
|
||||
@@ -67,7 +67,7 @@ impl<T: ReservedValue> PackedOption<T> {
|
||||
impl<T: ReservedValue> Default for PackedOption<T> {
|
||||
/// Create a default packed option representing `None`.
|
||||
fn default() -> Self {
|
||||
PackedOption(T::reserved_value())
|
||||
Self(T::reserved_value())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ impl<T: ReservedValue> From<T> for PackedOption<T> {
|
||||
t != T::reserved_value(),
|
||||
"Can't make a PackedOption from the reserved value."
|
||||
);
|
||||
PackedOption(t)
|
||||
Self(t)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,8 +126,7 @@ where
|
||||
// `(i + 1) * 8` = Last bit in byte.
|
||||
// `last - byte.leading_zeros()` = last set bit in byte.
|
||||
// `as usize` won't ever truncate as the potential range is `0..=8`.
|
||||
.map(|(i, byte)| ((i + 1) * 8) - byte.leading_zeros() as usize)
|
||||
.unwrap_or(0);
|
||||
.map_or(0, |(i, byte)| ((i + 1) * 8) - byte.leading_zeros() as usize);
|
||||
|
||||
Some(K::new(last_index))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user