Now allowing clippy::indexing_slicing globally in dcb-exe.

This commit is contained in:
2021-01-11 13:03:20 +00:00
parent a40802a84c
commit f0258052ba
5 changed files with 3 additions and 6 deletions

View File

@@ -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

View File

@@ -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}"),

View File

@@ -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<Self::Item> {
// If we're outside of code range, decode a directive
if !Inst::CODE_RANGE.contains(&self.cur_pos) {

View File

@@ -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();

View File

@@ -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)]