mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +00:00
Fix clippy warnings
This commit is contained in:
parent
efa45bb509
commit
06ce7b570f
@ -334,7 +334,7 @@ impl Cursive {
|
||||
/// Returns a mutable reference to the currently active screen.
|
||||
pub fn screen_mut(&mut self) -> &mut views::StackView {
|
||||
let id = self.active_screen;
|
||||
self.screens.get_mut(id).unwrap()
|
||||
&mut self.screens[id]
|
||||
}
|
||||
|
||||
/// Adds a new screen, and returns its ID.
|
||||
@ -515,7 +515,7 @@ impl Cursive {
|
||||
let printer =
|
||||
printer.sub_printer(Vec2::new(0, offset), printer.size, !selected);
|
||||
let id = self.active_screen;
|
||||
self.screens.get_mut(id).unwrap().draw(&printer);
|
||||
self.screens[id].draw(&printer);
|
||||
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ impl<'a> Iterator for LinesIterator<'a> {
|
||||
|
||||
// Find the ideal line, in an infinitely wide world.
|
||||
// We'll make a line larger than that.
|
||||
let next = content.find('\n').unwrap_or(content.len());
|
||||
let next = content.find('\n').unwrap_or_else(|| content.len());
|
||||
let content = &content[..next];
|
||||
|
||||
let allowed_width = if self.show_spaces {
|
||||
|
@ -315,7 +315,7 @@ impl TextArea {
|
||||
.find('\n')
|
||||
.map(|i| 1 + i + self.cursor);
|
||||
let last_row = last_byte.map_or(self.rows.len(), |last_byte| self.row_at(last_byte));
|
||||
let last_byte = last_byte.unwrap_or(self.content.len());
|
||||
let last_byte = last_byte.unwrap_or_else(|| self.content.len());
|
||||
|
||||
// println_stderr!("Content: `{}` (len={})",
|
||||
// self.content,
|
||||
|
Loading…
Reference in New Issue
Block a user