diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-05-01 00:06:50 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-05-01 00:06:50 +0530 |
| commit | b29846fb72326dc04bc13fe11d07965879787533 (patch) | |
| tree | 4e0e3c555edf03caa2ec84888e65e4373b39b511 /src/list.rs | |
| parent | 9c30356a3e0b333bab32ea1a866738fbab14ea11 (diff) | |
abide by the lord clippy
Diffstat (limited to 'src/list.rs')
| -rwxr-xr-x | src/list.rs | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/src/list.rs b/src/list.rs index 219b9a4..90f24d6 100755 --- a/src/list.rs +++ b/src/list.rs @@ -15,20 +15,9 @@ impl<T> ContentList<T> { // Go to next item in list pub fn next(&mut self) { let len = self.list.len(); - if len != 0 { - if self.index < len - 1 { - self.index += 1; - } + if len != 0 && self.index < len - 1 { + self.index += 1; } - - // let len = self.list.len(); - // if len != 0 { - // if self.index == self.list.len() - 1 { - // self.index = 0; - // } else { - // self.index += 1; - // } - // } } /// Go to previous item in list @@ -36,17 +25,15 @@ impl<T> ContentList<T> { if self.index != 0 { self.index -= 1; } - // if self.index == 0 { - // let len = self.list.len(); - // if len != 0 { - // self.index = len - 1; - // } - // } else { - // self.index -= 1; - // } } pub fn reset_index(&mut self) { self.index = 0; } } + +impl<T> Default for ContentList<T> { + fn default() -> Self { + Self::new() + } +} |
