Skip to content

Commit 1ec3d3e

Browse files
committed
Remove unneeded mut in ModuleTest::read_event
1 parent 75ea729 commit 1ec3d3e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/core/src/modules/list/tests/read_event.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn edit_mode_passthrough_event() {
99
read_event_test(Event::from('p'), |mut context| {
1010
let mut module = create_list(&Config::new(), context.take_todo_file());
1111
module.state = ListState::Edit;
12-
assert_eq!(context.read_event(&mut module), Event::from('p'));
12+
assert_eq!(context.read_event(&module), Event::from('p'));
1313
});
1414
}
1515

@@ -18,7 +18,7 @@ fn normal_mode_help() {
1818
read_event_test(Event::from('?'), |mut context| {
1919
let mut module = create_list(&Config::new(), context.take_todo_file());
2020
module.normal_mode_help.set_active();
21-
assert_eq!(context.read_event(&mut module), Event::from(StandardEvent::Help));
21+
assert_eq!(context.read_event(&module), Event::from(StandardEvent::Help));
2222
});
2323
}
2424

@@ -27,7 +27,7 @@ fn visual_mode_help() {
2727
read_event_test(Event::from('?'), |mut context| {
2828
let mut module = create_list(&Config::new(), context.take_todo_file());
2929
module.visual_mode_help.set_active();
30-
assert_eq!(context.read_event(&mut module), Event::from(StandardEvent::Help));
30+
assert_eq!(context.read_event(&module), Event::from(StandardEvent::Help));
3131
});
3232
}
3333

@@ -36,7 +36,7 @@ fn search() {
3636
read_event_test(Event::from('p'), |mut context| {
3737
let mut module = create_list(&Config::new(), context.take_todo_file());
3838
module.search_bar.start_search(Some(""));
39-
assert_eq!(context.read_event(&mut module), Event::from('p'));
39+
assert_eq!(context.read_event(&module), Event::from('p'));
4040
});
4141
}
4242

@@ -62,7 +62,7 @@ fn search() {
6262
fn default_events_single_char(#[case] binding: char, #[case] expected: MetaEvent) {
6363
read_event_test(Event::from(binding), |mut context| {
6464
let mut module = create_list(&Config::new(), context.take_todo_file());
65-
assert_eq!(context.read_event(&mut module), Event::from(expected));
65+
assert_eq!(context.read_event(&module), Event::from(expected));
6666
});
6767
}
6868

@@ -79,7 +79,7 @@ fn default_events_single_char(#[case] binding: char, #[case] expected: MetaEvent
7979
fn default_events_special(#[case] code: KeyCode, #[case] expected: MetaEvent) {
8080
read_event_test(Event::from(code), |mut context| {
8181
let mut module = create_list(&Config::new(), context.take_todo_file());
82-
assert_eq!(context.read_event(&mut module), Event::from(expected));
82+
assert_eq!(context.read_event(&module), Event::from(expected));
8383
});
8484
}
8585

@@ -91,7 +91,7 @@ fn fixup_events(#[case] binding: char, #[case] expected: MetaEvent) {
9191
read_event_test(Event::from(binding), |mut context| {
9292
let mut module = create_list(&Config::new(), context.take_todo_file());
9393
module.selected_line_action = Some(Action::Fixup);
94-
assert_eq!(context.read_event(&mut module), Event::from(expected));
94+
assert_eq!(context.read_event(&module), Event::from(expected));
9595
});
9696
}
9797

@@ -102,7 +102,7 @@ fn fixup_events_with_non_fixpo_event(#[case] binding: char) {
102102
read_event_test(Event::from(binding), |mut context| {
103103
let mut module = create_list(&Config::new(), context.take_todo_file());
104104
module.selected_line_action = Some(Action::Pick);
105-
assert_eq!(context.read_event(&mut module), Event::from(binding));
105+
assert_eq!(context.read_event(&module), Event::from(binding));
106106
});
107107
}
108108

@@ -117,7 +117,7 @@ fn mouse_move_down() {
117117
}),
118118
|mut context| {
119119
let mut module = create_list(&Config::new(), context.take_todo_file());
120-
assert_eq!(context.read_event(&mut module), Event::from(MetaEvent::MoveCursorDown));
120+
assert_eq!(context.read_event(&module), Event::from(MetaEvent::MoveCursorDown));
121121
},
122122
);
123123
}
@@ -133,7 +133,7 @@ fn mouse_move_up() {
133133
}),
134134
|mut context| {
135135
let mut module = create_list(&Config::new(), context.take_todo_file());
136-
assert_eq!(context.read_event(&mut module), Event::from(MetaEvent::MoveCursorUp));
136+
assert_eq!(context.read_event(&module), Event::from(MetaEvent::MoveCursorUp));
137137
},
138138
);
139139
}
@@ -148,14 +148,14 @@ fn mouse_other() {
148148
});
149149
read_event_test(mouse_event, |mut context| {
150150
let mut module = create_list(&Config::new(), context.take_todo_file());
151-
assert_eq!(context.read_event(&mut module), mouse_event);
151+
assert_eq!(context.read_event(&module), mouse_event);
152152
});
153153
}
154154

155155
#[test]
156156
fn event_other() {
157157
read_event_test(Event::None, |mut context| {
158158
let mut module = create_list(&Config::new(), context.take_todo_file());
159-
assert_eq!(context.read_event(&mut module), Event::None);
159+
assert_eq!(context.read_event(&module), Event::None);
160160
});
161161
}

src/core/src/testutil/module_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl TestContext {
3939
self.get_build_data(module)
4040
}
4141

42-
pub(crate) fn read_event(&mut self, module: &'_ mut dyn Module) -> Event {
42+
pub(crate) fn read_event(&mut self, module: &dyn Module) -> Event {
4343
let input_options = module.input_options();
4444
self.event_handler_context.event_handler.read_event(
4545
self.event_handler_context.state.read_event(),

0 commit comments

Comments
 (0)