~matthiasbeyer/maildir

f2a2e93ddc12d351e26ed8e80e487a904c4fa84b — Kartikaya Gupta 1 year, 5 months ago c8ce5e7
Run cargo fmt
2 files changed, 10 insertions(+), 10 deletions(-)

M src/lib.rs
M tests/smoke.rs
M src/lib.rs => src/lib.rs +9 -7
@@ 386,7 386,8 @@ impl Maildir {
    }

    fn update_flags<F>(&self, id: &str, flag_op: F) -> std::io::Result<()>
        where F: Fn(&str) -> String
    where
        F: Fn(&str) -> String,
    {
        let filter = |entry: &std::io::Result<MailEntry>| match *entry {
            Err(_) => false,


@@ 435,11 436,8 @@ impl Maildir {
    /// If the message doesn't have the flag(s) to be removed, those flags are
    /// ignored.
    pub fn remove_flags(&self, id: &str, flags: &str) -> std::io::Result<()> {
        let flag_strip = |old_flags: &str| {
            old_flags.chars()
                .filter(|c| !flags.contains(*c))
                .collect()
        };
        let flag_strip =
            |old_flags: &str| old_flags.chars().filter(|c| !flags.contains(*c)).collect();
        self.update_flags(id, &flag_strip)
    }



@@ 486,7 484,11 @@ impl Maildir {
        data: &[u8],
        flags: &str,
    ) -> std::result::Result<String, MaildirError> {
        self.store(Subfolder::Cur, data, &format!(":2,{}", Self::normalize_flags(flags)))
        self.store(
            Subfolder::Cur,
            data,
            &format!(":2,{}", Self::normalize_flags(flags)),
        )
    }

    fn store(

M tests/smoke.rs => tests/smoke.rs +1 -3
@@ 228,9 228,7 @@ fn check_store_cur() {
fn check_flag_fiddling() {
    with_maildir_empty("maildir2", |maildir| {
        maildir.create_dirs().unwrap();
        let id = maildir
            .store_cur_with_flags(TEST_MAIL_BODY, "SR")
            .unwrap();
        let id = maildir.store_cur_with_flags(TEST_MAIL_BODY, "SR").unwrap();

        assert_eq!(maildir.count_cur(), 1);
        assert_eq!(maildir.find(&id).unwrap().flags(), "RS");