Skip to content

Commit 2be77f9

Browse files
author
Rodolfo Gatti
committed
Fixed fmt issues.
1 parent a8b560b commit 2be77f9

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

src/diff3.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn parse_params<I: Iterator<Item = OsString>>(
164164
return Err(format!("Unknown option: \"{}\"", param_str));
165165
} else {
166166
// Regular file argument
167-
push_file_arg(param, &mut mine, &mut older, &mut yours, &params.executable)?;
167+
push_file_arg(param, &mut mine, &mut older, &mut yours, &params.executable)?;
168168
}
169169
}
170170

@@ -193,10 +193,7 @@ fn push_file_arg(
193193
} else if yours.is_none() {
194194
*yours = Some(param);
195195
} else {
196-
return Err(format!(
197-
"Usage: {} mine older yours",
198-
exe.to_string_lossy()
199-
));
196+
return Err(format!("Usage: {} mine older yours", exe.to_string_lossy()));
200197
}
201198
Ok(())
202199
}
@@ -300,7 +297,7 @@ fn compute_diff3(mine: &[u8], older: &[u8], yours: &[u8], params: &Diff3Params)
300297
return (Vec::new(), false);
301298
} else {
302299
let mut output = Vec::new();
303-
300+
304301
let mine_name = params.mine.to_string_lossy();
305302
let older_name = params.older.to_string_lossy();
306303
let yours_name = params.yours.to_string_lossy();
@@ -309,26 +306,23 @@ fn compute_diff3(mine: &[u8], older: &[u8], yours: &[u8], params: &Diff3Params)
309306
writeln!(
310307
&mut output,
311308
"Binary files {} and {} differ",
312-
mine_name,
313-
older_name
309+
mine_name, older_name
314310
)
315311
.unwrap();
316312
}
317313
if older_is_binary && yours_is_binary && older != yours {
318314
writeln!(
319315
&mut output,
320316
"Binary files {} and {} differ",
321-
older_name,
322-
yours_name
317+
older_name, yours_name
323318
)
324319
.unwrap();
325320
}
326321
if mine_is_binary && yours_is_binary && mine != yours {
327322
writeln!(
328323
&mut output,
329324
"Binary files {} and {} differ",
330-
mine_name,
331-
yours_name
325+
mine_name, yours_name
332326
)
333327
.unwrap();
334328
}
@@ -948,9 +942,9 @@ mod tests {
948942

949943
/// Checks if only easy (non-overlapping) conflicts exist
950944
fn has_only_easy_conflicts(regions: &[Diff3Region]) -> bool {
951-
regions
952-
.iter()
953-
.all(|r| r.conflict == ConflictType::NoConflict || r.conflict == ConflictType::EasyConflict)
945+
regions.iter().all(|r| {
946+
r.conflict == ConflictType::NoConflict || r.conflict == ConflictType::EasyConflict
947+
})
954948
}
955949

956950
/// Checks if overlapping (difficult) conflicts exist

tests/integration.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,8 @@ mod diff3 {
15891589
}
15901590

15911591
#[test]
1592-
fn diff3_without_strip_trailing_cr_shows_differences() -> Result<(), Box<dyn std::error::Error>> {
1592+
fn diff3_without_strip_trailing_cr_shows_differences() -> Result<(), Box<dyn std::error::Error>>
1593+
{
15931594
let tmp_dir = tempdir()?;
15941595

15951596
// Mine has CRLF, others have LF - should show differences without --strip-trailing-cr
@@ -1608,10 +1609,10 @@ mod diff3 {
16081609
let mut cmd = cargo_bin_cmd!("diffutils");
16091610
cmd.arg("diff3");
16101611
cmd.arg(&mine_path).arg(&older_path).arg(&yours_path);
1611-
1612+
16121613
let output = cmd.output()?;
16131614
let stdout = String::from_utf8_lossy(&output.stdout);
1614-
1615+
16151616
// Without --strip-trailing-cr, files with different line endings should be detected as different
16161617
// Exit code should be 1 (conflicts/differences) or output should show changes
16171618
assert!(

0 commit comments

Comments
 (0)