diff --git a/src/bin/cargo-fmt.rs b/src/bin/cargo-fmt.rs index b07a40804dd..2c0ec3a84dc 100644 --- a/src/bin/cargo-fmt.rs +++ b/src/bin/cargo-fmt.rs @@ -271,7 +271,6 @@ fn get_targets(workspace_hitlist: WorkspaceHitlist) -> Result, std:: std::io::ErrorKind::NotFound, str::from_utf8(&output.stderr).unwrap(), )) - } fn target_from_json(jtarget: &Value) -> Target { diff --git a/src/bin/rustfmt.rs b/src/bin/rustfmt.rs index d1f7a83187b..88bd3222fcb 100644 --- a/src/bin/rustfmt.rs +++ b/src/bin/rustfmt.rs @@ -102,7 +102,6 @@ fn match_cli_path_or_file( config_path: Option, input_file: &Path, ) -> FmtResult<(Config, Option)> { - if let Some(config_file) = config_path { let toml = Config::from_toml_path(config_file.as_ref())?; return Ok((toml, Some(config_file))); diff --git a/src/expr.rs b/src/expr.rs index d0e5df3abbb..298b8143b53 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -2985,7 +2985,6 @@ fn choose_rhs( } fn prefer_next_line(orig_rhs: &str, next_line_rhs: &str) -> bool { - fn count_line_breaks(src: &str) -> usize { src.chars().filter(|&x| x == '\n').count() } diff --git a/src/filemap.rs b/src/filemap.rs index ee0a21b39b1..72724da1c11 100644 --- a/src/filemap.rs +++ b/src/filemap.rs @@ -90,7 +90,6 @@ pub fn write_file( where T: Write, { - fn source_and_formatted_text( text: &StringBuffer, filename: &str, diff --git a/src/types.rs b/src/types.rs index f7cb3c53656..61ef03b1687 100644 --- a/src/types.rs +++ b/src/types.rs @@ -404,7 +404,6 @@ where } else { Some(format!("{}{}", args, output)) } - } fn type_bound_colon(context: &RewriteContext) -> &'static str { @@ -601,7 +600,6 @@ impl Rewrite for ast::TyParam { result.push_str(&join_bounds(context, shape, &strs)); } if let Some(ref def) = self.default { - let eq_str = match context.config.type_punctuation_density() { TypeDensity::Compressed => "=", TypeDensity::Wide => " = ", diff --git a/tests/source/fn-simple.rs b/tests/source/fn-simple.rs index e11df34ad86..e3d489411ad 100644 --- a/tests/source/fn-simple.rs +++ b/tests/source/fn-simple.rs @@ -51,5 +51,4 @@ pub fn waltz(cwd: &Path) -> CliAssert { formatted_comment = rewrite_comment(comment, block_style, width, offset, formatting_fig); } } - } diff --git a/tests/source/indent_match_arms.rs b/tests/source/indent_match_arms.rs index ecadbe705ff..75cee57f10d 100644 --- a/tests/source/indent_match_arms.rs +++ b/tests/source/indent_match_arms.rs @@ -23,5 +23,4 @@ fn main() { }, _ => "something else", } - } diff --git a/tests/source/issue-510.rs b/tests/source/issue-510.rs index 8f56be02e32..4c60859e6cf 100644 --- a/tests/source/issue-510.rs +++ b/tests/source/issue-510.rs @@ -3,7 +3,6 @@ fn solve_inline_size_constraints(&self, block: &mut BlockFlow, input: &ISizeConstraintInput) -> ISizeConstraintSolution { - let (inline_start,inline_size,margin_inline_start,margin_inline_end) = match (inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx,inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx) { (MaybeAuto::Auto, MaybeAuto::Auto, MaybeAuto::Auto) => { diff --git a/tests/source/spaces-within-angle-brackets.rs b/tests/source/spaces-within-angle-brackets.rs index fc8dcda4293..73cab841e2e 100644 --- a/tests/source/spaces-within-angle-brackets.rs +++ b/tests/source/spaces-within-angle-brackets.rs @@ -31,7 +31,6 @@ fn foo(a: T, b: E) { } fn foo(a: T, b: E) { - foo::(10, "bar"); let opt: Option; diff --git a/tests/source/spaces-within-parens.rs b/tests/source/spaces-within-parens.rs index 63978eaf854..dba8d7cf013 100644 --- a/tests/source/spaces-within-parens.rs +++ b/tests/source/spaces-within-parens.rs @@ -14,7 +14,6 @@ struct TupleStruct2(u32, u32); fn fooEmpty() {} fn foo(e: E, _: u32) -> (u32, u32) { - // Tuples let t1 = (); let t2 = (1,); diff --git a/tests/source/spaces-within-square-brackets.rs b/tests/source/spaces-within-square-brackets.rs index 6988ce5ed1c..d0466cacdd5 100644 --- a/tests/source/spaces-within-square-brackets.rs +++ b/tests/source/spaces-within-square-brackets.rs @@ -1,7 +1,6 @@ // rustfmt-spaces_within_square_brackets: true fn main() { - let arr: [i32; 5] = [1, 2, 3, 4, 5]; let arr: [i32; 500] = [0; 500]; diff --git a/tests/source/struct_tuple_visual.rs b/tests/source/struct_tuple_visual.rs index 8f935c1aa4d..d7d9e961bc4 100644 --- a/tests/source/struct_tuple_visual.rs +++ b/tests/source/struct_tuple_visual.rs @@ -3,7 +3,6 @@ // rustfmt-error_on_line_overflow: false // rustfmt-struct_lit_style: Visual fn foo() { - Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b()); Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(// Comment @@ -35,5 +34,4 @@ fn foo() { // /|\ \ // o o o o G) - } diff --git a/tests/target/fn-simple.rs b/tests/target/fn-simple.rs index e381b6e6231..a9640937f60 100644 --- a/tests/target/fn-simple.rs +++ b/tests/target/fn-simple.rs @@ -96,5 +96,4 @@ pub fn waltz(cwd: &Path) -> CliAssert { rewrite_comment(comment, block_style, width, offset, formatting_fig); } } - } diff --git a/tests/target/indent_match_arms.rs b/tests/target/indent_match_arms.rs index e0b34dbe03d..8d5e7ef7887 100644 --- a/tests/target/indent_match_arms.rs +++ b/tests/target/indent_match_arms.rs @@ -23,5 +23,4 @@ fn main() { }, _ => "something else", } - } diff --git a/tests/target/issue-510.rs b/tests/target/issue-510.rs index 54fe361bb4e..a166b68498f 100644 --- a/tests/target/issue-510.rs +++ b/tests/target/issue-510.rs @@ -4,7 +4,6 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced { block: &mut BlockFlow, input: &ISizeConstraintInput, ) -> ISizeConstraintSolution { - let (inline_start, inline_size, margin_inline_start, margin_inline_end) = match ( inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx, inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx, diff --git a/tests/target/spaces-within-angle-brackets.rs b/tests/target/spaces-within-angle-brackets.rs index 3969327b8ec..89335b602a4 100644 --- a/tests/target/spaces-within-angle-brackets.rs +++ b/tests/target/spaces-within-angle-brackets.rs @@ -31,7 +31,6 @@ fn foo< T, E >(a: T, b: E) { } fn foo< T: Send, E: Send >(a: T, b: E) { - foo::< u32, str >(10, "bar"); let opt: Option< u32 >; diff --git a/tests/target/spaces-within-parens.rs b/tests/target/spaces-within-parens.rs index 2a0a566ddea..651386c618b 100644 --- a/tests/target/spaces-within-parens.rs +++ b/tests/target/spaces-within-parens.rs @@ -14,7 +14,6 @@ struct TupleStruct2( u32, u32 ); fn fooEmpty() {} fn foo( e: E, _: u32 ) -> ( u32, u32 ) { - // Tuples let t1 = (); let t2 = ( 1, ); diff --git a/tests/target/spaces-within-square-brackets.rs b/tests/target/spaces-within-square-brackets.rs index 3a1b24d4def..cb468d6b59e 100644 --- a/tests/target/spaces-within-square-brackets.rs +++ b/tests/target/spaces-within-square-brackets.rs @@ -1,7 +1,6 @@ // rustfmt-spaces_within_square_brackets: true fn main() { - let arr: [ i32; 5 ] = [ 1, 2, 3, 4, 5 ]; let arr: [ i32; 500 ] = [ 0; 500 ]; diff --git a/tests/target/struct_tuple_visual.rs b/tests/target/struct_tuple_visual.rs index e63bc2c47c2..02811668bcb 100644 --- a/tests/target/struct_tuple_visual.rs +++ b/tests/target/struct_tuple_visual.rs @@ -3,7 +3,6 @@ // rustfmt-error_on_line_overflow: false // rustfmt-struct_lit_style: Visual fn foo() { - Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b()); Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo( @@ -45,5 +44,4 @@ fn foo() { // o o o o G, ) - }