Archived
1
0
forked from mars/breed

cargo fmt

This commit is contained in:
Roux 2023-04-11 23:55:33 -04:00
parent 8a110c5b01
commit f5ea473328

View File

@ -20,12 +20,7 @@
use std::{
env::args,
fs::File,
io::{
Read,
stdout,
Stdout,
Write,
},
io::{stdout, Read, Stdout, Write},
os::fd::FromRawFd,
};
@ -463,23 +458,22 @@ fn main() -> Result<()> {
let stdin = 0; // get stdin as a file descriptor
if unsafe { libc::isatty(stdin) } == 0 {
unsafe { File::from_raw_fd(stdin) }
} else { File::open("/dev/null").unwrap() }
},
Some(path) => {
std::fs::File::open(path).unwrap_or_else(|_| {
eprintln!(
"{}: {}: No such file or directory.",
argv[0],
argv[1]
);
} else {
File::open("/dev/null").unwrap()
}
}
Some(path) => std::fs::File::open(path).unwrap_or_else(|_| {
eprintln!("{}: {}: No such file or directory.", argv[0], argv[1]);
exit(EX_UNAVAILABLE);
})
},
}.read_to_end(&mut buf).unwrap();
}),
}
.read_to_end(&mut buf)
.unwrap();
let text = String::from_utf8(buf).unwrap_or_else(|_| {
eprintln!(
"{}: {}: File contents are not valid UTF-8.", argv[0], argv[1]
"{}: {}: File contents are not valid UTF-8.",
argv[0], argv[1]
);
exit(EX_DATAERR);
});