summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2022-11-24 19:58:23 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2022-11-24 19:58:23 +0200
commit5ba7b2cd7bb07abe8faafe5e45db6145b3f90bc9 (patch)
tree3a848deb24d1b19258e323b386c86caa423892df
parent104352e5950598f4a659bd593d587910af8adc12 (diff)
downloadmeli-5ba7b2cd7bb07abe8faafe5e45db6145b3f90bc9.zip
meli: fix clippy lints for meli binary
-rw-r--r--build.rs5
-rw-r--r--src/components/mail/listing.rs8
-rw-r--r--src/components/mail/listing/plain.rs2
-rw-r--r--src/types.rs2
4 files changed, 11 insertions, 6 deletions
diff --git a/build.rs b/build.rs
index a1c3eae7..7946d81b 100644
--- a/build.rs
+++ b/build.rs
@@ -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.",
);
- let file = File::create(&out_dir_path)
- .expect(&format!("Could not create file {}", out_dir_path.display()));
+ let file = File::create(&out_dir_path).unwrap_or_else(|err| {
+ panic!("Could not create file {}: {}", out_dir_path.display(), err)
+ });
let mut gz = GzBuilder::new()
.comment(output.stdout.len().to_string().into_bytes())
.write(file, Compression::default());
diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs
index 6e75a44b..72ec4703 100644
--- a/src/components/mail/listing.rs
+++ b/src/components/mail/listing.rs
@@ -84,8 +84,7 @@ impl<T> RowsState<T> {
self.thread_to_env
.get(&thread)
.iter()
- .map(|v| v.iter())
- .flatten()
+ .flat_map(|v| v.iter())
.any(|env_hash| self.selection[env_hash])
}
@@ -170,6 +169,11 @@ impl<T> RowsState<T> {
}
#[inline(always)]
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
+ #[inline(always)]
pub fn clear_selection(&mut self) {
for (k, v) in self.selection.iter_mut() {
if *v {
diff --git a/src/components/mail/listing/plain.rs b/src/components/mail/listing/plain.rs
index c54294c3..abcc9717 100644
--- a/src/components/mail/listing/plain.rs
+++ b/src/components/mail/listing/plain.rs
@@ -689,7 +689,7 @@ impl PlainListing {
let mut subject = e.subject().to_string();
subject.truncate_at_boundary(150);
EntryStrings {
- date: DateString(PlainListing::format_date(&e)),
+ date: DateString(PlainListing::format_date(e)),
subject: SubjectString(subject),
flag: FlagString(format!(
"{selected}{unseen}{attachments}{whitespace}",
diff --git a/src/types.rs b/src/types.rs
index e50a9797..b338e873 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -94,7 +94,7 @@ pub enum ForkType {
NewDraft(File, std::process::Child),
}
-#[derive(Debug, PartialEq, Copy, Clone)]
+#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum NotificationType {
Info,
Error(melib::error::ErrorKind),