Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lints introduced by clippy 1.78 to 1.80 #188

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cameleon/src/u3v/control_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const INITIAL_MAXIMUM_ACK_LENGTH: u32 = 128;
const PAYLOAD_TRANSFER_SIZE: u32 = 1024 * 64;

/// This handle provides low level API to read and write data from the device.
/// See [`ControlHandle::abrm`] and [`register_map`](super::register_map) which provide more
/// See [`ControlHandle::abrm`] and [`register_map`] which provide more
/// convenient way to communicate with `u3v` specific registers.
///
/// # Examples
Expand Down
18 changes: 9 additions & 9 deletions genapi/src/masked_int_reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl BitMask {
match sign {
Sign::Signed => {
if msb - lsb == 63 {
std::i64::MIN
i64::MIN
} else {
let value = 1 << (msb - lsb) as i64;
-value
Expand All @@ -394,13 +394,13 @@ impl BitMask {
self.msb(reg_byte_len, endianness),
);
if msb - lsb == 63 {
return std::i64::MAX;
return i64::MAX;
}
match sign {
Sign::Signed => (1 << (msb - lsb)) - 1,
Sign::Unsigned => {
if msb - lsb == 63 {
std::i64::MAX
i64::MAX
} else {
(1 << (msb - lsb + 1)) - 1
}
Expand Down Expand Up @@ -517,7 +517,7 @@ mod tests {

let sign = Sign::Unsigned;
assert_eq!(mask.min(reg_len, endianness, sign), 0);
assert_eq!(mask.max(reg_len, endianness, sign), std::i64::MAX);
assert_eq!(mask.max(reg_len, endianness, sign), i64::MAX);
let value = mask.apply_mask(reg_value, reg_len, endianness, sign);
assert_eq!(value, i64::MAX);
let new_value = mask
Expand All @@ -526,13 +526,13 @@ mod tests {
assert_eq!(new_value, 0);

let sign = Sign::Signed;
assert_eq!(mask.min(reg_len, endianness, sign), std::i64::MIN);
assert_eq!(mask.max(reg_len, endianness, sign), std::i64::MAX);
assert_eq!(mask.min(reg_len, endianness, sign), i64::MIN);
assert_eq!(mask.max(reg_len, endianness, sign), i64::MAX);
let value = mask.apply_mask(reg_value, reg_len, endianness, sign);
assert_eq!(value, std::i64::MAX);
assert_eq!(value, i64::MAX);
let new_value = mask
.masked_value(reg_value, std::i64::MIN, reg_len, endianness, sign)
.masked_value(reg_value, i64::MIN, reg_len, endianness, sign)
.unwrap();
assert_eq!(new_value, std::i64::MIN);
assert_eq!(new_value, i64::MIN);
}
}
2 changes: 1 addition & 1 deletion genapi/src/parser/elem_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ impl Parse for NodeId {
_: &mut impl CacheStoreBuilder,
) -> Self {
let text = node.next_text().unwrap();
node_builder.get_or_intern(&text.view())
node_builder.get_or_intern(text.view())
}
}

Expand Down
2 changes: 1 addition & 1 deletion genapi/src/parser/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Parse for PortNode {
let chunk_id = node.next_if(CHUNK_ID).map_or_else(
|| {
node.next_if(P_CHUNK_ID).map(|next_node| {
ImmOrPNode::PNode(node_builder.get_or_intern(&next_node.text().view()))
ImmOrPNode::PNode(node_builder.get_or_intern(next_node.text().view()))
})
},
|next_node| {
Expand Down
2 changes: 1 addition & 1 deletion genapi/src/parser/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Parse for StringNode {
.parse_if(STREAMABLE, node_builder, value_builder, cache_builder)
.unwrap_or_default();
let value = node.next_if(VALUE).map_or_else(
|| ImmOrPNode::PNode(node_builder.get_or_intern(&node.next_text().unwrap().view())),
|| ImmOrPNode::PNode(node_builder.get_or_intern(node.next_text().unwrap().view())),
|next_node| {
let id = value_builder.store(next_node.text().view().into_owned());
ImmOrPNode::Imm(id)
Expand Down
2 changes: 1 addition & 1 deletion genapi/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ impl CacheStore for DefaultCacheStore {
.and_modify(|level1| {
level1
.entry((address, length))
.and_modify(|level2| *level2 = data.to_owned())
.and_modify(|level2| data.clone_into(level2))
.or_insert_with(|| data.to_owned());
})
.or_insert_with(|| {
Expand Down
Loading