File tree 3 files changed +20
-15
lines changed
3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,9 @@ pub(crate) fn rule(
53
53
steps. push_back ( crate :: builder:: Step :: Whitespace ) ;
54
54
steps. push_back ( crate :: builder:: Step :: Comment ( text) ) ;
55
55
steps. push_back ( crate :: builder:: Step :: NewLine ) ;
56
- // Only add padding if there are no `trivialities` (that is, there's no extra
57
- // `Newlines(_)` to be added) or if the first one is a comment (that is, it'll need
56
+ // Only add padding if there are no `trivialities` (that is,
57
+ // there's no extra `Newlines(_)` to be added)
58
+ // or if the first one is a comment (that is, it'll need
58
59
// to be indented to match the content).
59
60
if matches ! (
60
61
child. trivialities. front( ) ,
@@ -77,9 +78,10 @@ pub(crate) fn rule(
77
78
match trivia {
78
79
crate :: children2:: Trivia :: Comment ( text) => {
79
80
steps. push_back ( crate :: builder:: Step :: Comment ( text) ) ;
80
- // If the next `trivia` is a newline, don't add newlines and padding at the
81
- // end of this iteration, as it will lead to a new blank line in the
82
- // output.
81
+ // If the next `trivia` is a newline, don't add newlines
82
+ // and padding at the
83
+ // end of this iteration, as it will lead to a new blank
84
+ // line in the output.
83
85
if matches ! (
84
86
trivia_iter. peek( ) ,
85
87
Some ( crate :: children2:: Trivia :: Newlines ( _) )
Original file line number Diff line number Diff line change 1
- use pretty_assertions:: assert_eq;
2
1
use std:: io:: Write ;
3
2
3
+ use pretty_assertions:: assert_eq;
4
+
4
5
#[ test]
5
6
fn cases ( ) {
6
7
let should_update = std:: env:: var ( "UPDATE" ) . is_ok ( ) ;
@@ -27,6 +28,10 @@ fn cases() {
27
28
28
29
let content_out = std:: fs:: read_to_string ( path_out. clone ( ) ) . unwrap ( ) ;
29
30
30
- assert_eq ! ( content_out, content_got, "Test case `{case}` failed; see `src/alejandra/tests/cases/{case}/`" ) ;
31
+ assert_eq ! (
32
+ content_out, content_got,
33
+ "Test case `{case}` failed; see \
34
+ `src/alejandra/tests/cases/{case}/`"
35
+ ) ;
31
36
}
32
37
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ struct CLIArgs {
51
51
52
52
#[ derive( Clone ) ]
53
53
struct FormattedPath {
54
- pub path : String ,
54
+ pub path : String ,
55
55
pub status : alejandra:: format:: Status ,
56
56
}
57
57
@@ -147,12 +147,12 @@ pub fn main() -> std::io::Result<()> {
147
147
let formatted_paths = match & include[ ..] {
148
148
& [ ] | & [ "-" ] => {
149
149
vec ! [ crate :: cli:: format_stdin( verbosity) ]
150
- } ,
150
+ }
151
151
include => {
152
152
let paths = crate :: find:: nix_files ( include, & args. exclude ) ;
153
153
154
154
crate :: cli:: format_paths ( paths, in_place, verbosity, threads)
155
- } ,
155
+ }
156
156
} ;
157
157
158
158
let errors = formatted_paths
@@ -183,11 +183,9 @@ pub fn main() -> std::io::Result<()> {
183
183
184
184
let changed = formatted_paths
185
185
. iter ( )
186
- . filter ( |formatted_path| {
187
- match formatted_path. status {
188
- alejandra:: format:: Status :: Changed ( changed) => changed,
189
- _ => false ,
190
- }
186
+ . filter ( |formatted_path| match formatted_path. status {
187
+ alejandra:: format:: Status :: Changed ( changed) => changed,
188
+ _ => false ,
191
189
} )
192
190
. count ( ) ;
193
191
You can’t perform that action at this time.
0 commit comments