Skip to content

Commit

Permalink
Add a bunch of clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Dec 2, 2024
1 parent 899e79f commit 8b431c9
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion crates/packet-forward/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,44 @@
#![cfg_attr(not(test), no_std)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#![cfg_attr(test, deny(clippy::assertions_on_result_states))]
#![cfg_attr(
not(test),
deny(
missing_docs,
rust_2018_idioms,
clippy::string_to_string,
clippy::std_instead_of_core,
clippy::string_add,
clippy::str_to_string,
clippy::infinite_loop,
clippy::unwrap_used,
clippy::expect_used,
clippy::panic,
clippy::cfg_not_test,
clippy::as_conversions,
clippy::alloc_instead_of_core,
clippy::float_arithmetic,
clippy::empty_docs,
clippy::empty_line_after_doc_comments,
clippy::empty_line_after_outer_attr,
clippy::suspicious_doc_comments,
clippy::redundant_locals,
clippy::redundant_comparisons,
clippy::out_of_bounds_indexing,
clippy::empty_loop,
clippy::cast_sign_loss,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_lossless,
clippy::arithmetic_side_effects,
clippy::dbg_macro,
clippy::print_stdout,
clippy::print_stderr
clippy::print_stderr,
clippy::shadow_unrelated,
clippy::useless_attribute,
clippy::zero_repeat_side_effects,
clippy::builtin_type_shadow
)
)]

Expand Down Expand Up @@ -886,6 +911,9 @@ where
#[inline]
fn new_error_ack(message: impl fmt::Display) -> AcknowledgementStatus {
AcknowledgementStatus::error(
// NB: allow expect here, because this should only fail if
// we construct an `AckStatusValue` with an empty message
#[allow(clippy::expect_used)]
AckStatusValue::new(format!("{MODULE} error: {message}"))
.expect("Acknowledgement error must not be empty"),
)
Expand Down Expand Up @@ -969,6 +997,8 @@ fn next_inflight_packet(
|inflight_packet| {
let retries_remaining = {
NonZeroU8::new(
// NB: we want to panic on purpose here
#[allow(clippy::expect_used)]
inflight_packet
.retries_remaining
.expect("We should only hit this branch with at least one retry remaining")
Expand Down

0 comments on commit 8b431c9

Please sign in to comment.