deny clippy::cast_lossless

reviewable/pr1352/r2
Tamir Duberstein 3 weeks ago
parent 82e72a14ad
commit 72104c4076
No known key found for this signature in database

@ -39,6 +39,7 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(
clippy::all,
clippy::cast_lossless,
clippy::use_self,
absolute_paths_not_starting_with_crate,
deprecated_in_future,

@ -174,7 +174,10 @@ pub(crate) unsafe fn netlink_qdisc_attach(
req.tc_info.tcm_handle = handle; // auto-assigned, if zero
req.tc_info.tcm_ifindex = if_index;
req.tc_info.tcm_parent = attach_type.tc_parent();
req.tc_info.tcm_info = tc_handler_make((priority as u32) << 16, htons(ETH_P_ALL as u16) as u32);
req.tc_info.tcm_info = tc_handler_make(
u32::from(priority) << 16,
u32::from(htons(ETH_P_ALL as u16)),
);
let attrs_buf = unsafe { request_attributes(&mut req, nlmsg_len) };
@ -242,7 +245,10 @@ pub(crate) unsafe fn netlink_qdisc_detach(
req.tc_info.tcm_family = AF_UNSPEC as u8;
req.tc_info.tcm_handle = handle; // auto-assigned, if zero
req.tc_info.tcm_info = tc_handler_make((priority as u32) << 16, htons(ETH_P_ALL as u16) as u32);
req.tc_info.tcm_info = tc_handler_make(
u32::from(priority) << 16,
u32::from(htons(ETH_P_ALL as u16)),
);
req.tc_info.tcm_parent = attach_type.tc_parent();
req.tc_info.tcm_ifindex = if_index;
@ -452,7 +458,7 @@ impl NetlinkSocket {
let message = NetlinkMessage::read(&buf[offset..])?;
offset += align_to(message.header.nlmsg_len as usize, NLMSG_ALIGNTO as usize);
multipart = message.header.nlmsg_flags & NLM_F_MULTI as u16 != 0;
match message.header.nlmsg_type as i32 {
match i32::from(message.header.nlmsg_type) {
NLMSG_ERROR => {
let err = message.error.unwrap();
if err.error == 0 {

@ -95,7 +95,7 @@ pub(crate) fn perf_event_open_trace_point(
attr.size = mem::size_of::<perf_event_attr>() as u32;
attr.type_ = PERF_TYPE_TRACEPOINT as u32;
attr.config = id as u64;
attr.config = u64::from(id);
let cpu = if pid.is_some() { -1 } else { 0 };
let pid = pid.unwrap_or(-1);

Loading…
Cancel
Save