Fix new clippy lints

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/482/head
Manos Pitsidianakis 1 month ago
parent 601e37117c
commit d20a9d0afa
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -113,9 +113,8 @@ impl<T> RowsState<T> {
self.env_order.insert(env_hash, index); self.env_order.insert(env_hash, index);
self.all_envelopes.insert(env_hash); self.all_envelopes.insert(env_hash);
} }
if !self.all_threads.contains(&thread) { if self.all_threads.insert(thread) {
self.thread_order.insert(thread, index); self.thread_order.insert(thread, index);
self.all_threads.insert(thread);
self.thread_to_env.insert(thread, env_hashes); self.thread_to_env.insert(thread, env_hashes);
} else { } else {
self.thread_to_env self.thread_to_env

@ -930,11 +930,11 @@ impl EmbeddedGrid {
stdin stdin
.write_all((terminal_size.1).to_string().as_bytes()) .write_all((terminal_size.1).to_string().as_bytes())
.unwrap(); .unwrap();
stdin.write_all(&[b';']).unwrap(); stdin.write_all(b";").unwrap();
stdin stdin
.write_all((terminal_size.0).to_string().as_bytes()) .write_all((terminal_size.0).to_string().as_bytes())
.unwrap(); .unwrap();
stdin.write_all(&[b't']).unwrap(); stdin.write_all(b"t").unwrap();
stdin.flush().unwrap(); stdin.flush().unwrap();
} else { } else {
//log::trace!("ignoring unknown code {}", //log::trace!("ignoring unknown code {}",
@ -947,15 +947,15 @@ impl EmbeddedGrid {
// Result is CSI r ; c R // Result is CSI r ; c R
//log::trace!("report cursor position"); //log::trace!("report cursor position");
//log::trace!("got {}", EscCode::from((&(*state), byte))); //log::trace!("got {}", EscCode::from((&(*state), byte)));
stdin.write_all(&[b'\x1b', b'[']).unwrap(); stdin.write_all(b"\x1b[").unwrap();
stdin stdin
.write_all((cursor.1 + 1).to_string().as_bytes()) .write_all((cursor.1 + 1).to_string().as_bytes())
.unwrap(); .unwrap();
stdin.write_all(&[b';']).unwrap(); stdin.write_all(b";").unwrap();
stdin stdin
.write_all((cursor.0 + 1).to_string().as_bytes()) .write_all((cursor.0 + 1).to_string().as_bytes())
.unwrap(); .unwrap();
stdin.write_all(&[b'R']).unwrap(); stdin.write_all(b"R").unwrap();
stdin.flush().unwrap(); stdin.flush().unwrap();
*state = State::Normal; *state = State::Normal;
} }

@ -299,8 +299,7 @@ impl Component for StatusBar {
crate::command::command_completion_suggestions(self.ex_buffer.as_str()); crate::command::command_completion_suggestions(self.ex_buffer.as_str());
suggestions.extend(command_completion_suggestions.iter().filter_map(|e| { suggestions.extend(command_completion_suggestions.iter().filter_map(|e| {
if !unique_suggestions.contains(e.as_str()) { if unique_suggestions.insert(e.as_str()) {
unique_suggestions.insert(e.as_str());
Some(e.clone().into()) Some(e.clone().into())
} else { } else {
None None

@ -1606,22 +1606,22 @@ fn atom_specials(input: &[u8]) -> IResult<&[u8], u8> {
#[inline(always)] #[inline(always)]
fn raw_chars(input: &[u8]) -> IResult<&[u8], u8> { fn raw_chars(input: &[u8]) -> IResult<&[u8], u8> {
byte_in_slice(&[b'(', b')', b'{', b' '])(input) byte_in_slice(b"(){ ")(input)
} }
#[inline(always)] #[inline(always)]
fn list_wildcards(input: &[u8]) -> IResult<&[u8], u8> { fn list_wildcards(input: &[u8]) -> IResult<&[u8], u8> {
byte_in_slice(&[b'%', b'*'])(input) byte_in_slice(b"%*")(input)
} }
#[inline(always)] #[inline(always)]
fn quoted_specials(input: &[u8]) -> IResult<&[u8], u8> { fn quoted_specials(input: &[u8]) -> IResult<&[u8], u8> {
byte_in_slice(&[b'"', b'\\'])(input) byte_in_slice(b"\"\\")(input)
} }
#[inline(always)] #[inline(always)]
fn resp_specials(input: &[u8]) -> IResult<&[u8], u8> { fn resp_specials(input: &[u8]) -> IResult<&[u8], u8> {
byte_in_slice(&[b']'])(input) byte_in_slice(b"]")(input)
} }
#[inline(always)] #[inline(always)]

@ -179,7 +179,7 @@ impl MboxFormat {
writer.write_all(line_ending)?; writer.write_all(line_ending)?;
if body.starts_with(b"From ") { if body.starts_with(b"From ") {
writer.write_all(&[b'>'])?; writer.write_all(b">")?;
} }
let mut i = 0; let mut i = 0;
if crlf { if crlf {
@ -187,13 +187,13 @@ impl MboxFormat {
if body[i..].starts_with(CRLF) { if body[i..].starts_with(CRLF) {
writer.write_all(CRLF)?; writer.write_all(CRLF)?;
if body[i..].starts_with(b"\r\nFrom ") { if body[i..].starts_with(b"\r\nFrom ") {
writer.write_all(&[b'>'])?; writer.write_all(b">")?;
} }
i += 2; i += 2;
} else if body[i] == b'\n' { } else if body[i] == b'\n' {
writer.write_all(CRLF)?; writer.write_all(CRLF)?;
if body[i..].starts_with(b"\nFrom ") { if body[i..].starts_with(b"\nFrom ") {
writer.write_all(&[b'>'])?; writer.write_all(b">")?;
} }
i += 1; i += 1;
} else { } else {
@ -206,13 +206,13 @@ impl MboxFormat {
if body[i..].starts_with(CRLF) { if body[i..].starts_with(CRLF) {
writer.write_all(LF)?; writer.write_all(LF)?;
if body[i..].starts_with(b"\r\nFrom ") { if body[i..].starts_with(b"\r\nFrom ") {
writer.write_all(&[b'>'])?; writer.write_all(b">")?;
} }
i += 2; i += 2;
} else { } else {
writer.write_all(&[body[i]])?; writer.write_all(&[body[i]])?;
if body[i..].starts_with(b"\nFrom ") { if body[i..].starts_with(b"\nFrom ") {
writer.write_all(&[b'>'])?; writer.write_all(b">")?;
} }
i += 1; i += 1;
} }

@ -1624,10 +1624,7 @@ impl Iterator for LineBreakText {
*state = LineBreakTextState::AtLine { *state = LineBreakTextState::AtLine {
cur_index: *cur_index + line.len() + 1, cur_index: *cur_index + line.len() + 1,
}; };
return Some( return Some(line.trim_end_matches(['\r', '\n']).to_string());
line.trim_end_matches(|c| c == '\r' || c == '\n')
.to_string(),
);
} }
if breaks.len() < 2 { if breaks.len() < 2 {
let mut line = line; let mut line = line;
@ -1673,14 +1670,14 @@ impl Iterator for LineBreakText {
if !line[*within_line_index..end_offset].is_empty() { if !line[*within_line_index..end_offset].is_empty() {
if *within_line_index == 0 { if *within_line_index == 0 {
let ret = line[*within_line_index..end_offset] let ret = line[*within_line_index..end_offset]
.trim_end_matches(|c| c == '\r' || c == '\n'); .trim_end_matches(['\r', '\n']);
*within_line_index = end_offset; *within_line_index = end_offset;
return Some(ret.to_string()); return Some(ret.to_string());
} else { } else {
let ret = format!( let ret = format!(
"⤷{}", "⤷{}",
&line[*within_line_index..end_offset] &line[*within_line_index..end_offset]
.trim_end_matches(|c| c == '\r' || c == '\n') .trim_end_matches(['\r', '\n'])
); );
*within_line_index = end_offset; *within_line_index = end_offset;
return Some(ret); return Some(ret);

Loading…
Cancel
Save