refactor(lint): improve and adapt to lints

This commit is contained in:
EdJoPaTo
2023-05-22 11:50:09 +02:00
parent 4d3a1eac30
commit 8a53caced7
3 changed files with 14 additions and 3 deletions
+3 -2
View File
@@ -1,5 +1,3 @@
#![allow(clippy::implicit_hasher)]
use crate::identifier::{TreeIdentifier, TreeIdentifierVec};
use crate::TreeItem;
@@ -9,16 +7,19 @@ pub struct Flattened<'a> {
}
impl<'a> Flattened<'a> {
#[must_use]
pub fn depth(&self) -> usize {
self.identifier.len() - 1
}
}
/// Get a flat list of all visible [`TreeItem`s](TreeItem)
#[must_use]
pub fn flatten<'a>(opened: &[TreeIdentifierVec], items: &'a [TreeItem<'a>]) -> Vec<Flattened<'a>> {
internal(opened, items, &[])
}
#[must_use]
fn internal<'a>(
opened: &[TreeIdentifierVec],
items: &'a [TreeItem<'a>],