Skip to content

Commit 3c044a9

Browse files
committed
refactor: derive Eq, Hash and Copy for View
To use as a key in a hashmap, a type must implement `Eq` and `Hash`. Additionally, `Copy` is required as well to be used in the .entry() method of Hashmap. Derive `Eq`, `Copy` and `Hash` on View to use it as a key in Hashmaps. Signed-off-by: Ivin Joel Abraham <[email protected]> Signed-off-by: Ivin Joel Abraham <[email protected]>
1 parent 0fb67e6 commit 3c044a9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/handler/details_actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn handle_patchset_details<B: Backend>(
6464
model.popup = Some(popup);
6565
}
6666
KeyCode::Esc | KeyCode::Char('q') => {
67-
let ps_da_clone = patchset_details_and_actions.last_screen.clone();
67+
let ps_da_clone = patchset_details_and_actions.last_screen;
6868
model.set_current_screen(ps_da_clone);
6969
model.reset_details_actions();
7070
}

src/model/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl Model {
255255
reviewed_by,
256256
tested_by,
257257
acked_by,
258-
last_screen: self.current_screen.clone(),
258+
last_screen: self.current_screen,
259259
lore_api_client: self.lore_api_client.clone(),
260260
patchset_path,
261261
});

src/model/screens/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub mod edit_config;
44
pub mod latest;
55
pub mod mail_list;
66

7-
#[derive(Debug, Clone, PartialEq)]
7+
#[derive(Copy, Debug, Clone, PartialEq, Eq, Hash)]
88
pub enum View {
99
MailingListSelection,
1010
BookmarkedPatchsets,

0 commit comments

Comments
 (0)