diff --git a/melib/src/maildir/mod.rs b/melib/src/maildir/mod.rs index 038e890c..849dde05 100644 --- a/melib/src/maildir/mod.rs +++ b/melib/src/maildir/mod.rs @@ -308,7 +308,7 @@ impl MaildirPathTrait for Path { flag } - fn set_flags(&self, flags: Flag, config: &Configuration) -> Result { + fn set_flags(&self, flags: Flag, _config: &Configuration) -> Result { let filename = self .file_name() .ok_or_else(|| format!("Could not get filename of `{}`", self.display(),))? @@ -324,11 +324,7 @@ impl MaildirPathTrait for Path { ); (filename.len(), true) }; - let mut new_name: String = if let Some(ref rename_regex) = config.rename_regex { - rename_regex.replace_all(&filename[..idx], "").to_string() - } else { - filename[..idx].to_string() - }; + let mut new_name: String = filename[..idx].to_string(); if append_2 { new_name.push_str(":2,"); } diff --git a/melib/src/maildir/tests.rs b/melib/src/maildir/tests.rs index 2e0f2f29..8db71aed 100644 --- a/melib/src/maildir/tests.rs +++ b/melib/src/maildir/tests.rs @@ -147,7 +147,7 @@ fn test_maildir_set_flags_regexp() { Path::new("/path/to/new/1423819205.29514_1.foo,U=123:2,S"), &[FlagOp::Set(Flag::FLAGGED | Flag::SEEN | Flag::REPLIED)] ), - Ok(Path::new("/path/to/new/1423819205.29514_1.foo:2,FRS").to_path_buf()), + Ok(Path::new("/path/to/new/1423819205.29514_1.foo,U=123:2,FRS").to_path_buf()), "Setting the same flags should not change the path" ); assert_eq!( @@ -156,7 +156,7 @@ fn test_maildir_set_flags_regexp() { Path::new("/path/to/new/1423819205.29514_1.foo,U=123:2,FRS"), &[FlagOp::UnSet(Flag::FLAGGED | Flag::SEEN | Flag::REPLIED)] ), - Ok(Path::new("/path/to/new/1423819205.29514_1.foo:2,").to_path_buf()), + Ok(Path::new("/path/to/new/1423819205.29514_1.foo,U=123:2,").to_path_buf()), "UnSetting all the set flags should change the path" ); assert_eq!( @@ -165,7 +165,7 @@ fn test_maildir_set_flags_regexp() { Path::new("/path/to/new/1423819205.29514_1.foo,U=123:2,FRS"), &[FlagOp::Set(Flag::FLAGGED | Flag::TRASHED)] ), - Ok(Path::new("/path/to/new/1423819205.29514_1.foo:2,FRST").to_path_buf()), + Ok(Path::new("/path/to/new/1423819205.29514_1.foo,U=123:2,FRST").to_path_buf()), "Setting new flags should change the path to include them" ); }