Skip to content

Commit 71f38d8

Browse files
committed
chore: Satisfy Clippy
1 parent c7d0705 commit 71f38d8

5 files changed

Lines changed: 17 additions & 25 deletions

File tree

src/backend/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ impl FromWorld for Config {
5454

5555
impl Config {
5656
#[mutants::skip]
57-
pub fn default() -> Self {
57+
#[allow(clippy::new_without_default)] // Default conflicts with FromWorld
58+
pub fn new() -> Self {
5859
default_table()
5960
}
6061
}
@@ -136,14 +137,12 @@ mod tests {
136137
Some(&Config {
137138
log: LogConfig {
138139
poll_interval_ms: 123,
139-
..default_table()
140140
},
141141
splash: SplashConfig {
142142
skip: true,
143143
total_duration_ms: 4567,
144144
..default_table()
145145
},
146-
..default_table()
147146
})
148147
);
149148
}

src/backend/poll.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ impl PollTimer {
5555
}
5656

5757
fn debounce(mut poll_timer: ResMut<Self>, mut ev_log_response: EventReader<LogResponseEvent>) {
58-
for _ in ev_log_response.read() {
58+
if ev_log_response.read().next().is_some() {
5959
poll_timer.reset();
60-
break;
6160
}
6261
}
6362
}
@@ -77,7 +76,7 @@ mod tests {
7776
log: LogConfig {
7877
poll_interval_ms: 50,
7978
},
80-
..Config::default()
79+
..Config::new()
8180
});
8281

8382
app.init_resource::<Time>();

src/frontend/change_buffer.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ impl Default for IndexSelection {
5757
}
5858
}
5959

60+
#[allow(clippy::large_enum_variant)]
6061
#[derive(Clone)]
6162
pub enum RevisionSelection {
6263
Single(Revision),
@@ -72,7 +73,7 @@ fn read_keys(
7273
) -> Result<()> {
7374
let mut change_buffer = change_buffer.get_single_mut()?;
7475

75-
if change_buffer.revisions.len() == 0 {
76+
if change_buffer.revisions.is_empty() {
7677
return Ok(());
7778
}
7879

@@ -225,9 +226,7 @@ impl StatefulWidget for ChangeBuffer {
225226

226227
let selected_lines = match self.selection {
227228
IndexSelection::Single(index) => map_index(index),
228-
IndexSelection::Range(start, end) => {
229-
map_index(start).start().clone()..=map_index(end).end().clone()
230-
}
229+
IndexSelection::Range(start, end) => *map_index(start).start()..=*map_index(end).end(),
231230
};
232231

233232
let mut lines = vec![];
@@ -286,9 +285,9 @@ impl LogLine {
286285
is_selected,
287286
})]
288287
}
289-
LogOutput::Revision(revision) => RevisionLine::vec_from(&revision, is_selected)
288+
LogOutput::Revision(revision) => RevisionLine::vec_from(revision, is_selected)
290289
.into_iter()
291-
.map(|l| Self::Revision(l))
290+
.map(Self::Revision)
292291
.collect(),
293292
}
294293
}

src/frontend/navigation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn plugin(app: &mut App) {
2222
///
2323
/// ```rust
2424
/// pub fn navigate(mut navigation: Navigation, state: Res<State>) {
25-
/// ...
25+
/// ...
2626
/// }
2727
/// ```
2828
#[derive(SystemParam)]
@@ -176,7 +176,7 @@ impl Navigation<'_, '_> {
176176
/// pub struct SpaceMenu;
177177
///
178178
/// pub fn plugin(app: &mut App) {
179-
/// app.add_systems(Update, read_keys.run_if(is_focused::<SpaceMenu>));
179+
/// app.add_systems(Update, read_keys.run_if(is_focused::<SpaceMenu>));
180180
/// }
181181
///
182182
/// fn read_keys(ev_keypress: EventReader<KeyEvent>) { ... }
@@ -246,7 +246,7 @@ mod tests {
246246
let entity = app.world_mut().spawn_empty().id();
247247

248248
(app.world_mut()).run_system_once(move |mut navigation: Navigation| {
249-
navigation.focus_as_root(entity.clone());
249+
navigation.focus_as_root(entity);
250250
})?;
251251

252252
(app.world_mut()).run_system_once(move |q: Query<(&Focus, &NavigationRoot)>| {

src/logger.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
//! ## Usage
44
//!
55
//! ```rust
6-
//! use crate::logger;
6+
//! logger::install();
77
//!
8-
//! fn main() {
9-
//! logger::install();
10-
//!
11-
//! // Your application code here
12-
//! info!("This is an info message");
13-
//! debug!("This is a debug message");
14-
//! warn!("This is a warning message");
15-
//!
16-
//! logger::dump();
8+
//! // Your application code here
9+
//! info!("This is an info message");
10+
//! debug!("This is a debug message");
11+
//! warn!("This is a warning message");
1712
//! }
1813
//! ```
1914

0 commit comments

Comments
 (0)