Skip to content

Commit f1ae3c0

Browse files
committed
style: Make clippy happy
1 parent 5c932b7 commit f1ae3c0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Diff for: clap_complete/src/engine/custom.rs

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ where
213213
/// ```
214214
pub struct PathCompleter {
215215
current_dir: Option<std::path::PathBuf>,
216+
#[allow(clippy::type_complexity)]
216217
filter: Option<Box<dyn Fn(&std::path::Path) -> bool + Send + Sync>>,
217218
stdio: bool,
218219
}

Diff for: clap_complete/src/env/mod.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,16 @@ impl<'s, F: Fn() -> clap::Command> CompleteEnv<'s, F> {
250250
let name = name.to_string_lossy();
251251

252252
let shell = self.shells.completer(&name).ok_or_else(|| {
253-
let shells = self
254-
.shells
255-
.names()
256-
.enumerate()
257-
.map(|(i, name)| {
258-
let prefix = if i == 0 { "" } else { ", " };
259-
format!("{prefix}`{name}`")
260-
})
261-
.collect::<String>();
253+
let shells =
254+
self.shells
255+
.names()
256+
.enumerate()
257+
.fold(String::new(), |mut seed, (i, name)| {
258+
use std::fmt::Write as _;
259+
let prefix = if i == 0 { "" } else { ", " };
260+
let _ = write!(&mut seed, "{prefix}`{name}`");
261+
seed
262+
});
262263
std::io::Error::new(
263264
std::io::ErrorKind::Other,
264265
format!("unknown shell `{name}`, expected one of {shells}"),

0 commit comments

Comments
 (0)