diff --git a/dcb-exe/src/exe/data/ty.rs b/dcb-exe/src/exe/data/ty.rs index 0d3202a..b82559e 100644 --- a/dcb-exe/src/exe/data/ty.rs +++ b/dcb-exe/src/exe/data/ty.rs @@ -99,7 +99,6 @@ impl std::str::FromStr for DataType { .ok_or(FromStrError::MissingArraySep)?; // Ignore the leading ';' on the second. - #[allow(clippy::indexing_slicing)] // This can't panic, as `pos < len`. let len = &len[1..]; // Trim both strings diff --git a/dcb-exe/src/exe/inst/directive.rs b/dcb-exe/src/exe/inst/directive.rs index 5a148dd..7313f09 100644 --- a/dcb-exe/src/exe/inst/directive.rs +++ b/dcb-exe/src/exe/inst/directive.rs @@ -152,7 +152,6 @@ impl InstFmt for Directive { fn fmt(&self, pos: Pos, bytes: &[u8], f: &mut std::fmt::Formatter) -> std::fmt::Result { let mnemonic = self.mnemonic(); #[allow(clippy::as_conversions)] // `len` will always fit into a `usize`. - #[allow(clippy::indexing_slicing)] // `pos .. pos + len` will always be valid. match self { Self::Dw(value) => write!(f, "{mnemonic} {value:#x}"), Self::Dh(value) => write!(f, "{mnemonic} {value:#x}"), diff --git a/dcb-exe/src/exe/inst/iter.rs b/dcb-exe/src/exe/inst/iter.rs index db74e67..6da9433 100644 --- a/dcb-exe/src/exe/inst/iter.rs +++ b/dcb-exe/src/exe/inst/iter.rs @@ -37,7 +37,6 @@ impl<'a> Iterator for ParseIter<'a> { type Item = (Pos, Inst); #[allow(clippy::as_conversions, clippy::cast_possible_truncation)] // Byte lengths will always fit into a `u32`, as `self.bytes.len()` is always smaller than `u32`. - #[allow(clippy::indexing_slicing)] // Our lengths will always be smaller than the bytes array they are used to index. fn next(&mut self) -> Option { // If we're outside of code range, decode a directive if !Inst::CODE_RANGE.contains(&self.cur_pos) { diff --git a/dcb-exe/src/exe/iter.rs b/dcb-exe/src/exe/iter.rs index 9406746..492249b 100644 --- a/dcb-exe/src/exe/iter.rs +++ b/dcb-exe/src/exe/iter.rs @@ -61,7 +61,6 @@ impl<'a> Iterator for Iter<'a> { } // Else simply get an instruction - #[allow(clippy::indexing_slicing)] // Can't panic, as `cur_pos < END` let mut iter = ParseIter::new(&self.exe.bytes[self.cur_pos.as_mem_idx()..], self.cur_pos); let (pos, inst) = iter.next().expect("Iterator was empty before code ending"); self.cur_pos = iter.cur_pos(); diff --git a/dcb-exe/src/lib.rs b/dcb-exe/src/lib.rs index 68fc6d2..3f94ad3 100644 --- a/dcb-exe/src/lib.rs +++ b/dcb-exe/src/lib.rs @@ -30,7 +30,7 @@ #![allow(clippy::unreadable_literal)] // We prefer suffixes to be glued to the literal #![allow(clippy::unseparated_literal_suffix)] -// We're fine with panicking when entering an unexpected state or on unfinished code. +// We're fine with panicking when entering an unexpected state // TODO: Remove `clippy::todo` once everything is finished. #![allow( clippy::panic, @@ -38,7 +38,8 @@ clippy::expect_used, clippy::todo, clippy::panic_in_result_fn, - clippy::unwrap_in_result + clippy::unwrap_in_result, + clippy::indexing_slicing )] // We prefer tail calls #![allow(clippy::implicit_return)]