mirror of
https://github.com/nushell/reedline.git
synced 2024-09-11 15:55:50 +03:00
Fix clippy lint from most recent Rust (#646)
https://rust-lang.github.io/rust-clippy/master/index.html#/format_collect
This commit is contained in:
parent
b1344f6a65
commit
fb9337dccb
@ -1,16 +1,15 @@
|
||||
use crate::{core_editor::Editor, UndoBehavior};
|
||||
|
||||
use {
|
||||
super::{
|
||||
menu_functions::{parse_selection_char, string_difference},
|
||||
Menu, MenuEvent, MenuTextStyle,
|
||||
},
|
||||
crate::{
|
||||
core_editor::Editor,
|
||||
painting::{estimate_single_line_wraps, Painter},
|
||||
Completer, Suggestion,
|
||||
Completer, Suggestion, UndoBehavior,
|
||||
},
|
||||
nu_ansi_term::{ansi::RESET, Style},
|
||||
std::iter::Sum,
|
||||
std::{fmt::Write, iter::Sum},
|
||||
unicode_width::UnicodeWidthStr,
|
||||
};
|
||||
|
||||
@ -625,11 +624,17 @@ impl Menu for ListMenu {
|
||||
// Final string with colors
|
||||
let line = &suggestion.value;
|
||||
let line = if line.lines().count() > self.max_lines as usize {
|
||||
let lines = line
|
||||
.lines()
|
||||
.take(self.max_lines as usize)
|
||||
.map(|string| format!("{}\r\n{}", string, self.multiline_marker))
|
||||
.collect::<String>();
|
||||
let lines = line.lines().take(self.max_lines as usize).fold(
|
||||
String::new(),
|
||||
|mut out_string, string| {
|
||||
let _ = write!(
|
||||
out_string,
|
||||
"{}\r\n{}",
|
||||
string, self.multiline_marker
|
||||
);
|
||||
out_string
|
||||
},
|
||||
);
|
||||
|
||||
lines + "..."
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user