chore: fix clippy issues + run clippy in CI (#45)

* Chore: fix clippy issues + run clippy in CI

* clippy

* clippy

* clippy

* Formatting
This commit is contained in:
Hendrik Eeckhaut
2024-11-11 15:18:40 +07:00
committed by GitHub
parent 43995c5526
commit 09f1abe261
13 changed files with 68 additions and 77 deletions

View File

@@ -103,16 +103,16 @@ impl NestedId {
}
}
impl ToString for NestedId {
fn to_string(&self) -> String {
impl std::fmt::Display for NestedId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
NestedId::String { id, root } => match root {
Some(root) => format!("{}/{}", root.to_string(), id),
None => id.to_string(),
Some(root) => write!(f, "{}/{}", root, id),
None => write!(f, "{}", id),
},
NestedId::Counter { value, root } => match root {
Some(root) => format!("{}/{}", root.to_string(), value),
None => value.to_string(),
Some(root) => write!(f, "{}/{}", root, value),
None => write!(f, "{}", value),
},
}
}

View File

@@ -17,9 +17,7 @@ pub trait DifferenceMut<Rhs> {
impl<T: Copy + Ord> DifferenceMut<Range<T>> for RangeSet<T> {
fn difference_mut(&mut self, other: &Range<T>) {
if other.is_empty() {
return;
} else if self.ranges.is_empty() {
if other.is_empty() || self.ranges.is_empty() {
return;
}

View File

@@ -165,6 +165,7 @@ impl<T: Copy + Ord> BitAnd<&RangeSet<T>> for RangeSet<T> {
}
#[cfg(test)]
#[allow(clippy::single_range_in_vec_init)]
mod tests {
use std::collections::HashSet;

View File

@@ -82,6 +82,7 @@ impl<T: Copy + Ord> Subset<RangeSet<T>> for RangeSet<T> {
}
#[cfg(test)]
#[allow(clippy::single_range_in_vec_init)]
mod tests {
use super::*;