clippy & cargo-deny fixes

This commit is contained in:
Luke Street 2025-01-27 17:03:12 -07:00
parent 8fb56c2fa4
commit d1b35c4d18
7 changed files with 10 additions and 13 deletions

View File

@ -61,7 +61,7 @@ jobs:
continue-on-error: ${{ matrix.checks == 'advisories' }} continue-on-error: ${{ matrix.checks == 'advisories' }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1 - uses: EmbarkStudios/cargo-deny-action@v2
with: with:
command: check ${{ matrix.checks }} command: check ${{ matrix.checks }}

View File

@ -74,6 +74,7 @@ ignore = [
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
#"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish #"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish
#{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" }, #{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" },
{ id = "RUSTSEC-2024-0384", reason = "unmaintained transient dependency, will be updated in next nod version" },
] ]
# If this is true, then cargo deny will use the git executable to fetch advisory database. # If this is true, then cargo deny will use the git executable to fetch advisory database.
# If this is false, then it uses a built-in git library. # If this is false, then it uses a built-in git library.

View File

@ -31,9 +31,8 @@ impl AnalysisPass for FindTRKInterruptVectorTable {
Ok(ret) => ret, Ok(ret) => ret,
Err(_) => continue, Err(_) => continue,
}; };
if data.starts_with(TRK_TABLE_HEADER.as_bytes()) let trk_table_bytes = TRK_TABLE_HEADER.as_bytes();
&& data[TRK_TABLE_HEADER.as_bytes().len()] == 0 if data.starts_with(trk_table_bytes) && data[trk_table_bytes.len()] == 0 {
{
log::debug!("Found gTRKInterruptVectorTable @ {:#010X}", start); log::debug!("Found gTRKInterruptVectorTable @ {:#010X}", start);
state.known_symbols.entry(start).or_default().push(ObjSymbol { state.known_symbols.entry(start).or_default().push(ObjSymbol {
name: "gTRKInterruptVectorTable".to_string(), name: "gTRKInterruptVectorTable".to_string(),

View File

@ -787,7 +787,7 @@ pub mod signed_hex_serde {
where D: Deserializer<'de> { where D: Deserializer<'de> {
struct SignedHexVisitor; struct SignedHexVisitor;
impl<'de> serde::de::Visitor<'de> for SignedHexVisitor { impl serde::de::Visitor<'_> for SignedHexVisitor {
type Value = i64; type Value = i64;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
@ -860,7 +860,7 @@ impl<'de> serde::Deserialize<'de> for SectionAddressRef {
where D: serde::Deserializer<'de> { where D: serde::Deserializer<'de> {
struct SectionAddressRefVisitor; struct SectionAddressRefVisitor;
impl<'de> serde::de::Visitor<'de> for SectionAddressRefVisitor { impl serde::de::Visitor<'_> for SectionAddressRefVisitor {
type Value = SectionAddressRef; type Value = SectionAddressRef;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

View File

@ -802,10 +802,7 @@ pub fn apply_map(mut result: MapInfo, obj: &mut ObjInfo) -> Result<()> {
} }
ObjSectionKind::Data | ObjSectionKind::ReadOnlyData => { ObjSectionKind::Data | ObjSectionKind::ReadOnlyData => {
if section.elf_index == 4 { if section.elf_index == 4 {
if result if result.section_symbols.get(".rodata").is_some_and(|m| !m.is_empty())
.section_symbols
.get(".rodata")
.map_or(false, |m| !m.is_empty())
{ {
".rodata" ".rodata"
} else { } else {

View File

@ -94,7 +94,7 @@ pub enum Bytes<'a> {
Owned(Box<[u8]>), Owned(Box<[u8]>),
} }
impl<'a> Bytes<'a> { impl Bytes<'_> {
pub fn into_owned(self) -> Box<[u8]> { pub fn into_owned(self) -> Box<[u8]> {
match self { match self {
Bytes::Borrowed(s) => Box::from(s), Bytes::Borrowed(s) => Box::from(s),
@ -103,7 +103,7 @@ impl<'a> Bytes<'a> {
} }
} }
impl<'a> AsRef<[u8]> for Bytes<'a> { impl AsRef<[u8]> for Bytes<'_> {
fn as_ref(&self) -> &[u8] { fn as_ref(&self) -> &[u8] {
match self { match self {
Bytes::Borrowed(s) => s, Bytes::Borrowed(s) => s,

View File

@ -149,7 +149,7 @@ impl<'a> U8View<'a> {
let mut idx = 1; let mut idx = 1;
let mut stop_at = None; let mut stop_at = None;
while let Some(node) = self.nodes.get(idx).copied() { while let Some(node) = self.nodes.get(idx).copied() {
if self.get_name(node).map_or(false, |name| name.eq_ignore_ascii_case(current)) { if self.get_name(node).is_ok_and(|name| name.eq_ignore_ascii_case(current)) {
current = next_non_empty(&mut split); current = next_non_empty(&mut split);
if current.is_empty() { if current.is_empty() {
return Some((idx, node)); return Some((idx, node));