Skip to content

Commit 321c79b

Browse files
authored
Merge pull request #652 from cgwalters/minor
tree-wide: Fix minor clippy lints
2 parents 0ce7d5e + cc0fdab commit 321c79b

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

lib/src/cli.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use fn_error_context::context;
1717
use ostree::gio;
1818
use ostree_container::store::PrepareResult;
1919
use ostree_ext::container as ostree_container;
20-
use ostree_ext::container::Transport;
2120
use ostree_ext::keyfileext::KeyFileExt;
2221
use ostree_ext::ostree;
2322

@@ -113,9 +112,9 @@ pub(crate) struct EditOpts {
113112
#[clap(rename_all = "lowercase")]
114113
pub(crate) enum OutputFormat {
115114
/// Output in YAML format.
116-
YAML,
115+
Yaml,
117116
/// Output in JSON format.
118-
JSON,
117+
Json,
119118
}
120119

121120
/// Perform an status operation

lib/src/kargs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(crate) fn get_kargs_in_root(d: &Dir, sys_arch: &str) -> Result<Vec<String>>
4242
// Read all the entries
4343
let mut entries = d.entries()?.collect::<std::io::Result<Vec<_>>>()?;
4444
// cc https://github.com/rust-lang/rust/issues/85573 re the allocation-per-comparison here
45-
entries.sort_by(|a, b| a.file_name().cmp(&b.file_name()));
45+
entries.sort_by_key(|a| a.file_name());
4646
for ent in entries {
4747
let name = ent.file_name();
4848
let name = name

lib/src/status.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,15 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> {
318318
// Filter to just the serializable status structures.
319319
let out = std::io::stdout();
320320
let mut out = out.lock();
321-
let format = opts.format.unwrap_or_else(|| {
322-
if opts.json {
323-
OutputFormat::JSON
324-
} else {
325-
OutputFormat::YAML
326-
}
327-
});
321+
let legacy_opt = if opts.json {
322+
OutputFormat::Json
323+
} else {
324+
OutputFormat::Yaml
325+
};
326+
let format = opts.format.unwrap_or(legacy_opt);
328327
match format {
329-
OutputFormat::JSON => serde_json::to_writer(&mut out, &host).map_err(anyhow::Error::new),
330-
OutputFormat::YAML => serde_yaml::to_writer(&mut out, &host).map_err(anyhow::Error::new),
328+
OutputFormat::Json => serde_json::to_writer(&mut out, &host).map_err(anyhow::Error::new),
329+
OutputFormat::Yaml => serde_yaml::to_writer(&mut out, &host).map_err(anyhow::Error::new),
331330
}
332331
.context("Writing to stdout")?;
333332

0 commit comments

Comments
 (0)