refactor(lint): adapt to future lints

This commit is contained in:
EdJoPaTo
2021-10-24 03:13:45 +02:00
parent b201b73345
commit 0659a5ae6f
+7 -17
View File
@@ -14,23 +14,13 @@ pub mod identifier;
pub use self::flatten::flatten; pub use self::flatten::flatten;
#[derive(Debug, Clone)] #[derive(Debug, Default, Clone)]
pub struct TreeState { pub struct TreeState {
offset: usize, offset: usize,
selected: TreeIdentifierVec, selected: TreeIdentifierVec,
opened: HashSet<TreeIdentifierVec>, opened: HashSet<TreeIdentifierVec>,
} }
impl Default for TreeState {
fn default() -> Self {
Self {
offset: 0,
selected: Vec::new(),
opened: HashSet::new(),
}
}
}
impl TreeState { impl TreeState {
pub fn selected(&self) -> Vec<usize> { pub fn selected(&self) -> Vec<usize> {
self.selected.clone() self.selected.clone()
@@ -74,7 +64,7 @@ impl TreeState {
self.opened.iter().cloned().collect() self.opened.iter().cloned().collect()
} }
pub fn get_offset(&self) -> usize { pub const fn get_offset(&self) -> usize {
self.offset self.offset
} }
} }
@@ -122,7 +112,7 @@ impl<'a> TreeItem<'a> {
self.text.height() self.text.height()
} }
pub fn style(mut self, style: Style) -> Self { pub const fn style(mut self, style: Style) -> Self {
self.style = style; self.style = style;
self self
} }
@@ -165,22 +155,22 @@ impl<'a> Tree<'a> {
self self
} }
pub fn style(mut self, style: Style) -> Self { pub const fn style(mut self, style: Style) -> Self {
self.style = style; self.style = style;
self self
} }
pub fn highlight_symbol(mut self, highlight_symbol: &'a str) -> Self { pub const fn highlight_symbol(mut self, highlight_symbol: &'a str) -> Self {
self.highlight_symbol = Some(highlight_symbol); self.highlight_symbol = Some(highlight_symbol);
self self
} }
pub fn highlight_style(mut self, style: Style) -> Self { pub const fn highlight_style(mut self, style: Style) -> Self {
self.highlight_style = style; self.highlight_style = style;
self self
} }
pub fn start_corner(mut self, corner: Corner) -> Self { pub const fn start_corner(mut self, corner: Corner) -> Self {
self.start_corner = corner; self.start_corner = corner;
self self
} }