updated formatting options
This commit is contained in:
parent
28aa3ad783
commit
44e14fbfba
2 changed files with 13 additions and 6 deletions
11
README.md
11
README.md
|
@ -199,10 +199,19 @@ number will be updated as follows:
|
||||||
when adding the ability to exclude extensions, and when fif gained the ability to output a bash script rather than a
|
when adding the ability to exclude extensions, and when fif gained the ability to output a bash script rather than a
|
||||||
list of invalid filenames). The MINOR version will also be bumped when increasing the MSRV.
|
list of invalid filenames). The MINOR version will also be bumped when increasing the MSRV.
|
||||||
- The PATCH version will be bumped in all other cases, including minor feature additions (in the past, this has occurred
|
- The PATCH version will be bumped in all other cases, including minor feature additions (in the past, this has occurred
|
||||||
when adding features such as more output formats and the ignore flag).
|
when adding features such as more output formats and the "ignore unknown extensions" flag).
|
||||||
|
|
||||||
If/when fif hits version 1.0, these rules will likely remain the same as they are now.
|
If/when fif hits version 1.0, these rules will likely remain the same as they are now.
|
||||||
|
|
||||||
|
## Code style
|
||||||
|
fif is formatted with `rustfmt` using a nightly toolchain, specifically with the command `cargo +nightly fmt`. Tabs are
|
||||||
|
used for indentation, and are assumed to be two spaces wide. Lines are 120 characters wide. Braces are placed on the
|
||||||
|
same line (["OTBS"](https://en.wikipedia.org/wiki/Indentation_style#Variant:_1TBS_(OTBS)) format), except in the case of
|
||||||
|
`where` clauses in generic parameters.
|
||||||
|
|
||||||
|
For more detailed information on the formatting rules used by this project, see the configured options in
|
||||||
|
[`rustfmt.toml`](https://gitlab.com/Lynnesbian/fif/-/blob/master/rustfmt.toml).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Copyright (C) 2021 Lynnesbian
|
Copyright (C) 2021 Lynnesbian
|
||||||
|
|
||||||
|
|
|
@ -215,20 +215,18 @@ fn main() {
|
||||||
} else {
|
} else {
|
||||||
let mut buffered_stdout = BufWriter::new(stdout());
|
let mut buffered_stdout = BufWriter::new(stdout());
|
||||||
|
|
||||||
let result = match args.output_format {
|
if match args.output_format {
|
||||||
// TODO: simplify this to something like formats::write_all(args.output_format, ...)
|
// TODO: simplify this to something like formats::write_all(args.output_format, ...)
|
||||||
OutputFormat::Sh => formats::Shell.write_all(&mut buffered_stdout, &findings, &errors),
|
OutputFormat::Sh => formats::Shell.write_all(&mut buffered_stdout, &findings, &errors),
|
||||||
OutputFormat::PowerShell => formats::PowerShell.write_all(&mut buffered_stdout, &findings, &errors),
|
OutputFormat::PowerShell => formats::PowerShell.write_all(&mut buffered_stdout, &findings, &errors),
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
OutputFormat::Json => formats::Json.write_all(&mut buffered_stdout, &findings, &errors),
|
OutputFormat::Json => formats::Json.write_all(&mut buffered_stdout, &findings, &errors),
|
||||||
OutputFormat::Text => formats::Text.write_all(&mut buffered_stdout, &findings, &errors),
|
OutputFormat::Text => formats::Text.write_all(&mut buffered_stdout, &findings, &errors),
|
||||||
};
|
}.is_err() {
|
||||||
|
|
||||||
if result.is_err() {
|
|
||||||
error!("Failed to write to stdout.");
|
error!("Failed to write to stdout.");
|
||||||
exit(exitcode::IOERR);
|
exit(exitcode::IOERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if buffered_stdout.flush().is_err() {
|
if buffered_stdout.flush().is_err() {
|
||||||
error!("Failed to flush stdout.");
|
error!("Failed to flush stdout.");
|
||||||
exit(exitcode::IOERR);
|
exit(exitcode::IOERR);
|
||||||
|
|
Loading…
Reference in a new issue