Skip to content

Commit

Permalink
Address clippy reported issues
Browse files Browse the repository at this point in the history
This change addresses a few issues that clippy reports in newer versions
of Rust.
  • Loading branch information
d-e-s-o committed Oct 7, 2023
1 parent b748c3b commit 9a83777
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/id.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022 Daniel Mueller ([email protected])
// Copyright (C) 2022-2023 Daniel Mueller ([email protected])
// SPDX-License-Identifier: GPL-3.0-or-later

use std::cmp::Ordering;
Expand Down Expand Up @@ -56,10 +56,7 @@ impl<T> Id<T> {

impl<T> Clone for Id<T> {
fn clone(&self) -> Self {
Self {
id: self.id,
_phantom: PhantomData,
}
*self
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/ui/tab_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,37 +600,37 @@ mod tests {

#[test]
fn search_tabs() {
let tabs = vec![1, 2, 3];
let tabs = [1, 2, 3];
let selected = 0;
let reverse = false;
let snapshot = search_snapshot(tabs.iter().copied(), selected, reverse);
assert_eq!(snapshot, vec![1, 2, 3, 1]);

let tabs = vec![1, 2, 3, 4];
let tabs = [1, 2, 3, 4];
let selected = 1;
let reverse = false;
let snapshot = search_snapshot(tabs.iter().copied(), selected, reverse);
assert_eq!(snapshot, vec![2, 3, 4, 1, 2]);

let tabs = vec![1, 2, 3];
let tabs = [1, 2, 3];
let selected = 2;
let reverse = false;
let snapshot = search_snapshot(tabs.iter().copied(), selected, reverse);
assert_eq!(snapshot, vec![3, 1, 2, 3]);

let tabs = vec![1, 2, 3];
let tabs = [1, 2, 3];
let selected = 0;
let reverse = true;
let snapshot = search_snapshot(tabs.iter().copied(), selected, reverse);
assert_eq!(snapshot, vec![1, 3, 2, 1]);

let tabs = vec![1, 2, 3, 4, 5];
let tabs = [1, 2, 3, 4, 5];
let selected = 1;
let reverse = true;
let snapshot = search_snapshot(tabs.iter().copied(), selected, reverse);
assert_eq!(snapshot, vec![2, 1, 5, 4, 3, 2]);

let tabs = vec![1, 2, 3];
let tabs = [1, 2, 3];
let selected = 2;
let reverse = true;
let snapshot = search_snapshot(tabs.iter().copied(), selected, reverse);
Expand Down

0 comments on commit 9a83777

Please sign in to comment.