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.all_envelopes.insert(env_hash);
}
if !self.all_threads.contains(&thread) {
if self.all_threads.insert(thread) {
self.thread_order.insert(thread, index);
self.all_threads.insert(thread);
self.thread_to_env.insert(thread, env_hashes);
} else {
self.thread_to_env

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

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

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

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

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

Loading…
Cancel
Save