mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-05-15 17:58:44 +00:00
Avoid nested function definition
This commit is contained in:
parent
c658a997f3
commit
e0334f79fe
@ -233,16 +233,6 @@ impl<'a> ListState<'a> {
|
|||||||
)?;
|
)?;
|
||||||
next_ln(stdout)?;
|
next_ln(stdout)?;
|
||||||
|
|
||||||
fn hotkey(writer: &mut MaxLenWriter, hotkey: &[u8]) -> io::Result<()> {
|
|
||||||
writer
|
|
||||||
.stdout
|
|
||||||
.queue(SetForegroundColor(Color::Yellow))?
|
|
||||||
.queue(SetAttribute(Attribute::Bold))?;
|
|
||||||
writer.write_ascii(hotkey)?;
|
|
||||||
writer.stdout.queue(ResetColor)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut writer = MaxLenWriter::new(stdout, self.term_width as usize);
|
let mut writer = MaxLenWriter::new(stdout, self.term_width as usize);
|
||||||
if self.message.is_empty() {
|
if self.message.is_empty() {
|
||||||
// Help footer message
|
// Help footer message
|
||||||
@ -446,3 +436,14 @@ impl<'a> ListState<'a> {
|
|||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Draw an emphasized hotkey in the list footer.
|
||||||
|
fn hotkey(writer: &mut MaxLenWriter, hotkey: &[u8]) -> io::Result<()> {
|
||||||
|
writer
|
||||||
|
.stdout
|
||||||
|
.queue(SetForegroundColor(Color::Yellow))?
|
||||||
|
.queue(SetAttribute(Attribute::Bold))?;
|
||||||
|
writer.write_ascii(hotkey)?;
|
||||||
|
writer.stdout.queue(ResetColor)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user