Remove SuppressionsIter

This commit is contained in:
Douglas Creager
2025-01-24 18:09:01 -05:00
parent a5f5aa4a6b
commit e5befdf8ff

View File

@@ -214,7 +214,7 @@ fn check_unused_suppressions(context: &mut CheckSuppressionsContext) {
);
// Collect all suppressions that are unused after type-checking.
for suppression in all {
for suppression in all.iter() {
if context.diagnostics.is_used(suppression.id()) {
continue;
}
@@ -401,23 +401,11 @@ impl Suppressions {
})
}
fn iter(&self) -> SuppressionsIter {
fn iter(&self) -> impl Iterator<Item = &Suppression> + '_ {
self.file.iter().chain(&self.line)
}
}
pub(crate) type SuppressionsIter<'a> =
std::iter::Chain<std::slice::Iter<'a, Suppression>, std::slice::Iter<'a, Suppression>>;
impl<'a> IntoIterator for &'a Suppressions {
type Item = &'a Suppression;
type IntoIter = SuppressionsIter<'a>;
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
/// A `type: ignore` or `knot: ignore` suppression.
///
/// Suppression comments that suppress multiple codes