meli: fix clippy lints for meli binary

pull/168/head
Manos Pitsidianakis 2022-11-24 19:58:23 +02:00
parent 104352e595
commit 5ba7b2cd7b
4 changed files with 11 additions and 6 deletions

View File

@ -60,8 +60,9 @@ fn main() {
"could not execute `mandoc` or `man`. If the binaries are not available in the PATH, disable `cli-docs` feature to be able to continue compilation.", "could not execute `mandoc` or `man`. If the binaries are not available in the PATH, disable `cli-docs` feature to be able to continue compilation.",
); );
let file = File::create(&out_dir_path) let file = File::create(&out_dir_path).unwrap_or_else(|err| {
.expect(&format!("Could not create file {}", out_dir_path.display())); panic!("Could not create file {}: {}", out_dir_path.display(), err)
});
let mut gz = GzBuilder::new() let mut gz = GzBuilder::new()
.comment(output.stdout.len().to_string().into_bytes()) .comment(output.stdout.len().to_string().into_bytes())
.write(file, Compression::default()); .write(file, Compression::default());

View File

@ -84,8 +84,7 @@ impl<T> RowsState<T> {
self.thread_to_env self.thread_to_env
.get(&thread) .get(&thread)
.iter() .iter()
.map(|v| v.iter()) .flat_map(|v| v.iter())
.flatten()
.any(|env_hash| self.selection[env_hash]) .any(|env_hash| self.selection[env_hash])
} }
@ -169,6 +168,11 @@ impl<T> RowsState<T> {
self.entries.len() self.entries.len()
} }
#[inline(always)]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
#[inline(always)] #[inline(always)]
pub fn clear_selection(&mut self) { pub fn clear_selection(&mut self) {
for (k, v) in self.selection.iter_mut() { for (k, v) in self.selection.iter_mut() {

View File

@ -689,7 +689,7 @@ impl PlainListing {
let mut subject = e.subject().to_string(); let mut subject = e.subject().to_string();
subject.truncate_at_boundary(150); subject.truncate_at_boundary(150);
EntryStrings { EntryStrings {
date: DateString(PlainListing::format_date(&e)), date: DateString(PlainListing::format_date(e)),
subject: SubjectString(subject), subject: SubjectString(subject),
flag: FlagString(format!( flag: FlagString(format!(
"{selected}{unseen}{attachments}{whitespace}", "{selected}{unseen}{attachments}{whitespace}",

View File

@ -94,7 +94,7 @@ pub enum ForkType {
NewDraft(File, std::process::Child), NewDraft(File, std::process::Child),
} }
#[derive(Debug, PartialEq, Copy, Clone)] #[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum NotificationType { pub enum NotificationType {
Info, Info,
Error(melib::error::ErrorKind), Error(melib::error::ErrorKind),