From 2e686d271e5e03ad6bf460ad3157e33020a7cc8e Mon Sep 17 00:00:00 2001 From: Joshua Job Date: Wed, 16 Apr 2025 16:18:45 -0700 Subject: [PATCH] Fixed Lints --- src/bitfield.rs | 14 +++++++------- src/facts.rs | 6 +++--- src/layout.rs | 6 +++--- src/lib.rs | 2 +- src/msr.rs | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/bitfield.rs b/src/bitfield.rs index 9414031..ff5030a 100644 --- a/src/bitfield.rs +++ b/src/bitfield.rs @@ -137,7 +137,7 @@ impl<'a, T: Bindable> Bound<'a, T> { } } -impl<'a> fmt::Display for Bound<'a, Flag> { +impl fmt::Display for Bound<'_, Flag> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { write!( f, @@ -152,7 +152,7 @@ impl<'a> fmt::Display for Bound<'a, Flag> { } } -impl<'a> fmt::Display for Bound<'a, Int> { +impl fmt::Display for Bound<'_, Int> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { write!( f, @@ -163,7 +163,7 @@ impl<'a> fmt::Display for Bound<'a, Int> { } } -impl<'a, B, R, T: From + From> Facter for Bound<'a, B> +impl + From> Facter for Bound<'_, B> where R: Default + Into, B: Bindable, @@ -176,7 +176,7 @@ where } } -impl<'a> fmt::Display for Bound<'a, X86Model> { +impl fmt::Display for Bound<'_, X86Model> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { write!( f, @@ -187,7 +187,7 @@ impl<'a> fmt::Display for Bound<'a, X86Model> { } } -impl<'a> fmt::Display for Bound<'a, X86Family> { +impl fmt::Display for Bound<'_, X86Family> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { write!( f, @@ -225,7 +225,7 @@ impl<'a> BoundField<'a> { } } -impl<'a> fmt::Display for BoundField<'a> { +impl fmt::Display for BoundField<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { match self { Self::Int(bound) => bound.fmt(f), @@ -236,7 +236,7 @@ impl<'a> fmt::Display for BoundField<'a> { } } -impl<'a, T: From + From> Facter for BoundField<'a> { +impl + From> Facter for BoundField<'_> { fn collect_fact(&self) -> GenericFact { match self { Self::Int(bound) => bound.collect_fact(), diff --git a/src/facts.rs b/src/facts.rs index d14d00c..0f03637 100644 --- a/src/facts.rs +++ b/src/facts.rs @@ -113,7 +113,7 @@ impl FactSet { pub fn added_facts<'to>( &'to self, to: &'to Self, - ) -> NameIteration<'to, T, impl Iterator> { + ) -> NameIteration<'to, T, impl Iterator> { let name_iter = to.name_set.difference(&self.name_set); NameIteration { iter: name_iter, @@ -125,7 +125,7 @@ impl FactSet { pub fn removed_facts<'to>( &'to self, to: &'to Self, - ) -> NameIteration<'to, T, impl Iterator> { + ) -> NameIteration<'to, T, impl Iterator> { let name_iter = self.name_set.difference(&to.name_set); NameIteration { iter: name_iter, @@ -137,7 +137,7 @@ impl FactSet { pub fn changed_facts<'to>( &'to self, to: &'to Self, - ) -> ChangedIterator<'to, T, impl Iterator> { + ) -> ChangedIterator<'to, T, impl Iterator> { let name_iter = self.backing.keys(); ChangedIterator { iter: name_iter, diff --git a/src/layout.rs b/src/layout.rs index 278014e..e6c0fb2 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -335,7 +335,7 @@ pub struct BoundLeaf<'a> { pub sub_leaves: Vec, } -impl<'a> BoundLeaf<'a> { +impl BoundLeaf<'_> { pub fn get_facts + From + From>(&self) -> Vec> { let mut facts = self.desc.get_facts(&self.sub_leaves); facts.iter_mut().for_each(|i| { @@ -345,13 +345,13 @@ impl<'a> BoundLeaf<'a> { } } -impl<'a, T: From + From + From> facts::Facter> for BoundLeaf<'a> { +impl + From + From> facts::Facter> for BoundLeaf<'_> { fn collect_facts(&self) -> Vec> { self.get_facts() } } -impl<'a> fmt::Display for BoundLeaf<'a> { +impl fmt::Display for BoundLeaf<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { self.desc.display_leaf(&self.sub_leaves, f) } diff --git a/src/lib.rs b/src/lib.rs index e0156bf..e7c3e16 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -95,7 +95,7 @@ impl CpuidDB for RunningCpuidDB { 0..=0x3FFFFFFF => leaf <= self.basic_max, 0x40000000..=0x4fffffff => self .hypervisor_max - .map_or(false, |max| leaf - 0x40000000 <= max), + .is_some_and(|max| leaf - 0x40000000 <= max), 0x80000000..=0x8fffffff => leaf - 0x80000000 <= self.extended_max, _ => false, } { diff --git a/src/msr.rs b/src/msr.rs index 41e598e..2a2cfb0 100644 --- a/src/msr.rs +++ b/src/msr.rs @@ -114,7 +114,7 @@ pub struct MSRValue<'a> { pub value: u64, } -impl<'a, T: From + From + From> facts::Facter> for MSRValue<'a> { +impl + From + From> facts::Facter> for MSRValue<'_> { fn collect_facts(&self) -> Vec> { let value = self.value.into(); self.desc @@ -130,7 +130,7 @@ impl<'a, T: From + From + From> facts::Facter> } } -impl<'a> fmt::Display for MSRValue<'a> { +impl fmt::Display for MSRValue<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f, "{} = {:#x}", self.desc, self.value)?; for field in &self.desc.fields {