@@ -476,6 +476,7 @@ export rust_common_flags := --edition=2021 \
-Wclippy::all \
-Wclippy::as_ptr_cast_mut \
-Wclippy::as_underscore \
+ -Wclippy::cast_lossless \
-Wclippy::ignored_unit_patterns \
-Wclippy::mut_mut \
-Wclippy::needless_bitwise_bool \
@@ -386,7 +386,7 @@ fn next(&mut self) -> Option<Self::Item> {
match self.segment {
Segment::Binary(data) => {
if self.offset < data.len() {
- let byte = data[self.offset] as u16;
+ let byte = data[self.offset].into();
self.offset += 1;
Some((byte, 8))
} else {
@@ -25,6 +25,7 @@
)]
#[allow(dead_code)]
+#[allow(clippy::cast_lossless)]
#[allow(clippy::ptr_as_ptr)]
#[allow(clippy::undocumented_unsafe_blocks)]
mod bindings_raw {
@@ -142,7 +142,7 @@ pub fn is_autoneg_enabled(&self) -> bool {
// SAFETY: The struct invariant ensures that we may access
// this field without additional synchronization.
let bit_field = unsafe { &(*self.0.get())._bitfield_1 };
- bit_field.get(13, 1) == bindings::AUTONEG_ENABLE as u64
+ bit_field.get(13, 1) == bindings::AUTONEG_ENABLE.into()
}
/// Gets the current auto-negotiation state.
@@ -426,7 +426,7 @@ impl<T: Driver> Adapter<T> {
// where we hold `phy_device->lock`, so the accessors on
// `Device` are okay to call.
let dev = unsafe { Device::from_raw(phydev) };
- T::match_phy_device(dev) as i32
+ T::match_phy_device(dev).into()
}
/// # Safety
@@ -14,6 +14,7 @@
#![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))]
#![allow(
clippy::all,
+ clippy::cast_lossless,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
dead_code,