From b33bc268d591a106a44cfccea4a2b5c9472d2d15 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 1 Mar 2021 07:42:45 -0500 Subject: [PATCH] My rustfmt is up-to-date with the gitlab ci one again --- .gitlab-ci.yml | 6 +----- tor-consdiff/src/lib.rs | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba05341f6..3d89626a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,11 +13,7 @@ rust-latest: - cargo test --verbose --all - rustup component add clippy rustfmt - cargo clippy -- -D warnings -#### -# Temporarily disabled while the CI version of rustfmt doesn't agree -# with nickm's. -# -# - cargo fmt --all -- --check + - cargo fmt --all -- --check rust-nightly: stage: build diff --git a/tor-consdiff/src/lib.rs b/tor-consdiff/src/lib.rs index 0b979a89a..a76df220e 100644 --- a/tor-consdiff/src/lib.rs +++ b/tor-consdiff/src/lib.rs @@ -318,7 +318,7 @@ impl<'a> DiffCommand<'a> { /// Return true if this is an Insert command. fn is_insert(&self) -> bool { - matches!(self, DiffCommand::Insert {..}) + matches!(self, DiffCommand::Insert { .. }) } /// Extract a single command from a line iterator that yields lines @@ -674,17 +674,31 @@ mod test { assert!(matches!(p, DeleteToEnd { low: 100 })); let p = parse("30,40c\nHello\nWorld\n.\n")?; - assert!(matches!(p, Replace{ low: 30, high: 40, .. })); + assert!(matches!( + p, + Replace { + low: 30, + high: 40, + .. + } + )); assert_eq!(p.lines(), Some(&["Hello", "World"][..])); let p = parse("30c\nHello\nWorld\n.\n")?; - assert!(matches!(p, Replace{ low: 30, high: 30, .. })); + assert!(matches!( + p, + Replace { + low: 30, + high: 30, + .. + } + )); assert_eq!(p.lines(), Some(&["Hello", "World"][..])); let p = parse("999a\nHello\nWorld\n.\n")?; - assert!(matches!(p, Insert{ pos: 999, .. })); + assert!(matches!(p, Insert { pos: 999, .. })); assert_eq!(p.lines(), Some(&["Hello", "World"][..])); let p = parse("0a\nHello\nWorld\n.\n")?; - assert!(matches!(p, Insert{ pos: 0, .. })); + assert!(matches!(p, Insert { pos: 0, .. })); assert_eq!(p.lines(), Some(&["Hello", "World"][..])); parse_err("hello world");