mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-06 10:03:30 +02:00
Avoid nested function definition
This commit is contained in:
+11
-10
@@ -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(())
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user