mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-03-30 19:19:19 +00:00
Apply pedantic Clippy lints
This commit is contained in:
parent
0ffeb14402
commit
337f6b1521
@ -433,7 +433,7 @@ impl AppState {
|
||||
.is_err()
|
||||
{
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
let success = exercise.run_exercise(None, &slf.cmd_runner);
|
||||
let progress = match success {
|
||||
|
||||
@ -23,7 +23,7 @@ pub struct ExerciseInfo {
|
||||
#[serde(default)]
|
||||
pub skip_check_unsolved: bool,
|
||||
}
|
||||
#[inline(always)]
|
||||
#[inline]
|
||||
const fn default_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
@ -171,9 +171,9 @@ fn main() -> Result<ExitCode> {
|
||||
stdout.write_all(b"\n")?;
|
||||
|
||||
return Ok(ExitCode::FAILURE);
|
||||
} else {
|
||||
app_state.render_final_message(&mut stdout)?;
|
||||
}
|
||||
|
||||
app_state.render_final_message(&mut stdout)?;
|
||||
}
|
||||
Some(Subcommands::Reset { name }) => {
|
||||
app_state.set_current_exercise_by_name(&name)?;
|
||||
|
||||
@ -197,15 +197,15 @@ pub fn progress_bar<'a>(
|
||||
total: u16,
|
||||
term_width: u16,
|
||||
) -> io::Result<()> {
|
||||
debug_assert!(total <= 999);
|
||||
debug_assert!(progress <= total);
|
||||
|
||||
const PREFIX: &[u8] = b"Progress: [";
|
||||
const PREFIX_WIDTH: u16 = PREFIX.len() as u16;
|
||||
const POSTFIX_WIDTH: u16 = "] xxx/xxx".len() as u16;
|
||||
const WRAPPER_WIDTH: u16 = PREFIX_WIDTH + POSTFIX_WIDTH;
|
||||
const MIN_LINE_WIDTH: u16 = WRAPPER_WIDTH + 4;
|
||||
|
||||
debug_assert!(total <= 999);
|
||||
debug_assert!(progress <= total);
|
||||
|
||||
if term_width < MIN_LINE_WIDTH {
|
||||
writer.write_ascii(b"Progress: ")?;
|
||||
// Integers are in ASCII.
|
||||
|
||||
@ -60,7 +60,7 @@ impl<'a> WatchState<'a> {
|
||||
watch_event_sender,
|
||||
terminal_event_unpause_receiver,
|
||||
manual_run,
|
||||
)
|
||||
);
|
||||
})
|
||||
.context("Failed to spawn a thread to handle terminal events")?;
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ pub fn terminal_event_handler(
|
||||
// Pause input until quitting the confirmation prompt.
|
||||
if unpause_receiver.recv().is_err() {
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -64,7 +64,7 @@ pub fn terminal_event_handler(
|
||||
return;
|
||||
}
|
||||
}
|
||||
Ok(Event::FocusGained | Event::FocusLost | Event::Mouse(_)) => continue,
|
||||
Ok(Event::FocusGained | Event::FocusLost | Event::Mouse(_)) => (),
|
||||
Err(e) => break WatchEvent::TerminalEventErr(e),
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user