Skip to content

Commit

Permalink
Merge pull request #652 from cgwalters/minor
Browse files Browse the repository at this point in the history
tree-wide: Fix minor clippy lints
  • Loading branch information
cgwalters authored Jun 28, 2024
2 parents 0ce7d5e + cc0fdab commit 321c79b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
5 changes: 2 additions & 3 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use fn_error_context::context;
use ostree::gio;
use ostree_container::store::PrepareResult;
use ostree_ext::container as ostree_container;
use ostree_ext::container::Transport;
use ostree_ext::keyfileext::KeyFileExt;
use ostree_ext::ostree;

Expand Down Expand Up @@ -113,9 +112,9 @@ pub(crate) struct EditOpts {
#[clap(rename_all = "lowercase")]
pub(crate) enum OutputFormat {
/// Output in YAML format.
YAML,
Yaml,
/// Output in JSON format.
JSON,
Json,
}

/// Perform an status operation
Expand Down
2 changes: 1 addition & 1 deletion lib/src/kargs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub(crate) fn get_kargs_in_root(d: &Dir, sys_arch: &str) -> Result<Vec<String>>
// Read all the entries
let mut entries = d.entries()?.collect::<std::io::Result<Vec<_>>>()?;
// cc https://github.com/rust-lang/rust/issues/85573 re the allocation-per-comparison here
entries.sort_by(|a, b| a.file_name().cmp(&b.file_name()));
entries.sort_by_key(|a| a.file_name());
for ent in entries {
let name = ent.file_name();
let name = name
Expand Down
17 changes: 8 additions & 9 deletions lib/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,15 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
// Filter to just the serializable status structures.
let out = std::io::stdout();
let mut out = out.lock();
let format = opts.format.unwrap_or_else(|| {
if opts.json {
OutputFormat::JSON
} else {
OutputFormat::YAML
}
});
let legacy_opt = if opts.json {
OutputFormat::Json
} else {
OutputFormat::Yaml
};
let format = opts.format.unwrap_or(legacy_opt);
match format {
OutputFormat::JSON => serde_json::to_writer(&mut out, &host).map_err(anyhow::Error::new),
OutputFormat::YAML => serde_yaml::to_writer(&mut out, &host).map_err(anyhow::Error::new),
OutputFormat::Json => serde_json::to_writer(&mut out, &host).map_err(anyhow::Error::new),
OutputFormat::Yaml => serde_yaml::to_writer(&mut out, &host).map_err(anyhow::Error::new),
}
.context("Writing to stdout")?;

Expand Down

0 comments on commit 321c79b

Please sign in to comment.