fix clippy warning

This commit is contained in:
Stephan Dilly 2020-03-27 01:15:00 +01:00
parent 8e7d2eb4a1
commit 68d8d47c62
2 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ pub enum AsyncNotification {
} }
/// helper function to calculate the hash of an arbitrary type that implements the `Hash` trait /// helper function to calculate the hash of an arbitrary type that implements the `Hash` trait
pub fn hash<T: Hash>(v: &T) -> u64 { pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
let mut hasher = DefaultHasher::new(); let mut hasher = DefaultHasher::new();
v.hash(&mut hasher); v.hash(&mut hasher);
hasher.finish() hasher.finish()

View file

@ -36,9 +36,9 @@ impl IndexComponent {
} }
/// ///
pub fn update(&mut self, list: &Vec<StatusItem>) { pub fn update(&mut self, list: &[StatusItem]) {
if hash(&self.items) != hash(list) { if hash(&self.items) != hash(list) {
self.items = list.clone(); self.items = list.to_owned();
let old_selection = self.selection.unwrap_or_default(); let old_selection = self.selection.unwrap_or_default();
self.selection = if self.items.is_empty() { self.selection = if self.items.is_empty() {