Skip to content

Commit 0a80479

Browse files
oech3sylvestre
authored andcommitted
head: remove print(ln) macros
1 parent 57406ce commit 0a80479

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/uu/head/src/head.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,15 @@ fn head_file(input: &mut File, options: &HeadOptions) -> io::Result<u64> {
401401

402402
#[allow(clippy::cognitive_complexity)]
403403
fn uu_head(options: &HeadOptions) -> UResult<()> {
404+
let mut stdout = io::stdout().lock();
404405
let mut first = true;
405406
for file in &options.files {
406407
let res = if file == "-" {
407408
if (options.files.len() > 1 && !options.quiet) || options.verbose {
408409
if !first {
409-
println!();
410+
writeln!(stdout)?;
410411
}
411-
println!("{}", translate!("head-header-stdin"));
412+
writeln!(stdout, "{}", translate!("head-header-stdin"))?;
412413
}
413414
let stdin = io::stdin();
414415

@@ -463,11 +464,11 @@ fn uu_head(options: &HeadOptions) -> UResult<()> {
463464
};
464465
if (options.files.len() > 1 && !options.quiet) || options.verbose {
465466
if !first {
466-
println!();
467+
writeln!(stdout)?;
467468
}
468-
print!("==> ");
469+
write!(stdout, "==> ")?;
469470
print_verbatim(file).unwrap();
470-
println!(" <==");
471+
writeln!(stdout, " <==")?;
471472
}
472473
head_file(&mut file_handle, options)?;
473474
Ok(())

0 commit comments

Comments
 (0)