From d0302c55566684dfcbdfb57f486253fec7133b11 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 4 May 2023 15:53:36 -0400 Subject: [PATCH] chore: Inline simple non-mixed format args --- clap_builder/src/builder/arg.rs | 2 +- clap_builder/src/builder/command.rs | 21 ++--- clap_builder/src/builder/debug_asserts.rs | 2 +- clap_builder/src/builder/value_parser.rs | 8 +- clap_builder/src/error/mod.rs | 2 +- clap_builder/src/macros.rs | 5 +- clap_builder/src/output/help_template.rs | 25 ++---- clap_builder/src/output/textwrap/core.rs | 4 +- clap_builder/src/output/usage.rs | 29 +++--- clap_builder/src/parser/arg_matcher.rs | 22 ++--- .../src/parser/matches/arg_matches.rs | 4 +- clap_builder/src/parser/parser.rs | 89 ++++++------------- clap_builder/src/parser/validator.rs | 34 +++---- clap_complete/examples/dynamic.rs | 2 +- clap_complete/src/dynamic.rs | 17 ++-- clap_complete/src/generator/mod.rs | 6 +- clap_complete/src/lib.rs | 2 +- clap_complete/src/shells/bash.rs | 4 +- clap_complete/src/shells/fish.rs | 2 +- clap_complete/src/shells/powershell.rs | 7 +- clap_complete/src/shells/zsh.rs | 2 +- clap_complete_fig/src/fig.rs | 16 ++-- clap_derive/src/item.rs | 8 +- clap_lex/src/lib.rs | 16 ++-- examples/cargo-example.rs | 2 +- examples/find.rs | 4 +- examples/git.rs | 2 +- examples/repl.rs | 2 +- examples/tutorial_builder/01_quick.rs | 2 +- examples/tutorial_builder/04_01_enum.rs | 2 +- examples/tutorial_builder/04_02_parse.rs | 2 +- examples/tutorial_builder/04_02_validate.rs | 4 +- examples/tutorial_builder/04_03_relations.rs | 4 +- examples/tutorial_builder/04_04_custom.rs | 4 +- examples/tutorial_builder/05_01_assert.rs | 2 +- tests/builder/conflicts.rs | 30 +++---- tests/builder/multiple_values.rs | 2 +- tests/derive_ui/bool_value_enum.rs | 2 +- tests/derive_ui/clap_empty_attr.rs | 2 +- tests/derive_ui/default_value_t_invalid.rs | 2 +- tests/derive_ui/default_values_t_invalid.rs | 2 +- tests/derive_ui/enum_flatten.rs | 2 +- tests/derive_ui/flatten_and_methods.rs | 2 +- tests/derive_ui/group_name_attribute.rs | 2 +- .../derive_ui/multiple_external_subcommand.rs | 2 +- tests/derive_ui/non_existent_attr.rs | 2 +- tests/derive_ui/rename_all_wrong_casing.rs | 2 +- tests/derive_ui/skip_flatten.rs | 2 +- tests/derive_ui/skip_subcommand.rs | 2 +- tests/derive_ui/skip_with_other_options.rs | 2 +- tests/derive_ui/skip_without_default.rs | 2 +- tests/derive_ui/struct_subcommand.rs | 2 +- tests/derive_ui/subcommand_and_flatten.rs | 2 +- tests/derive_ui/subcommand_and_methods.rs | 2 +- tests/derive_ui/subcommand_opt_opt.rs | 2 +- tests/derive_ui/subcommand_opt_vec.rs | 2 +- tests/derive_ui/tuple_struct.rs | 2 +- 57 files changed, 179 insertions(+), 252 deletions(-) diff --git a/clap_builder/src/builder/arg.rs b/clap_builder/src/builder/arg.rs index 34a8c1f9989..ddd4418499b 100644 --- a/clap_builder/src/builder/arg.rs +++ b/clap_builder/src/builder/arg.rs @@ -4107,7 +4107,7 @@ impl Arg { /// let value_parser = cmd.get_arguments() /// .find(|a| a.get_id() == "port").unwrap() /// .get_value_parser(); - /// println!("{:?}", value_parser); + /// println!("{value_parser:?}"); /// ``` pub fn get_value_parser(&self) -> &super::ValueParser { if let Some(value_parser) = self.value_parser.as_ref() { diff --git a/clap_builder/src/builder/command.rs b/clap_builder/src/builder/command.rs index 9363c36acdd..48f3d6fac0a 100644 --- a/clap_builder/src/builder/command.rs +++ b/clap_builder/src/builder/command.rs @@ -684,10 +684,7 @@ impl Command { if let Some(command) = argv0.file_stem().and_then(|f| f.to_str()) { // Stop borrowing command so we can get another mut ref to it. let command = command.to_owned(); - debug!( - "Command::try_get_matches_from_mut: Parsed command {} from argv", - command - ); + debug!("Command::try_get_matches_from_mut: Parsed command {command} from argv"); debug!("Command::try_get_matches_from_mut: Reinserting command into arguments so subcommand parser matches it"); raw_args.insert(&cursor, [&command]); @@ -789,7 +786,7 @@ impl Command { /// let mut cmd = Command::new("myprog"); /// let mut out = io::stdout(); /// let help = cmd.render_help(); - /// println!("{}", help); + /// println!("{help}"); /// ``` /// [`io::Write`]: std::io::Write /// [`-h` (short)]: Arg::help() @@ -816,7 +813,7 @@ impl Command { /// let mut cmd = Command::new("myprog"); /// let mut out = io::stdout(); /// let help = cmd.render_long_help(); - /// println!("{}", help); + /// println!("{help}"); /// ``` /// [`io::Write`]: std::io::Write /// [`-h` (short)]: Arg::help() @@ -984,7 +981,7 @@ impl Command { /// /// let r = cmd.try_get_matches_from(vec!["cmd", "-c", "file", "-f", "-x"]); /// - /// assert!(r.is_ok(), "unexpected error: {:?}", r); + /// assert!(r.is_ok(), "unexpected error: {r:?}"); /// let m = r.unwrap(); /// assert_eq!(m.get_one::("config").unwrap(), "file"); /// assert!(m.get_flag("f")); @@ -3695,7 +3692,7 @@ impl Command { /// let cmd = clap::Command::new("raw") /// .external_subcommand_value_parser(clap::value_parser!(String)); /// let value_parser = cmd.get_external_subcommand_value_parser(); - /// println!("{:?}", value_parser); + /// println!("{value_parser:?}"); /// ``` pub fn get_external_subcommand_value_parser(&self) -> Option<&super::ValueParser> { if !self.is_allow_external_subcommands_set() { @@ -3792,7 +3789,7 @@ impl Command { let mut parser = Parser::new(self); if let Err(error) = parser.get_matches_with(&mut matcher, raw_args, args_cursor) { if self.is_set(AppSettings::IgnoreErrors) { - debug!("Command::_do_parse: ignoring error: {}", error); + debug!("Command::_do_parse: ignoring error: {error}"); } else { return Err(error); } @@ -4436,7 +4433,7 @@ impl Command { /// Iterate through the groups this arg is member of. pub(crate) fn groups_for_arg<'a>(&'a self, arg: &Id) -> impl Iterator + 'a { - debug!("Command::groups_for_arg: id={:?}", arg); + debug!("Command::groups_for_arg: id={arg:?}"); let arg = arg.clone(); self.groups .iter() @@ -4476,7 +4473,7 @@ impl Command { } pub(crate) fn unroll_args_in_group(&self, group: &Id) -> Vec { - debug!("Command::unroll_args_in_group: group={:?}", group); + debug!("Command::unroll_args_in_group: group={group:?}"); let mut g_vec = vec![group]; let mut args = vec![]; @@ -4489,7 +4486,7 @@ impl Command { .args .iter() { - debug!("Command::unroll_args_in_group:iter: entity={:?}", n); + debug!("Command::unroll_args_in_group:iter: entity={n:?}"); if !args.contains(n) { if self.find(n).is_some() { debug!("Command::unroll_args_in_group:iter: this is an arg"); diff --git a/clap_builder/src/builder/debug_asserts.rs b/clap_builder/src/builder/debug_asserts.rs index b7bb1ff8329..c01662e1582 100644 --- a/clap_builder/src/builder/debug_asserts.rs +++ b/clap_builder/src/builder/debug_asserts.rs @@ -482,7 +482,7 @@ fn assert_app_flags(cmd: &Command) { )+ if !s.is_empty() { - panic!("{}", s) + panic!("{s}") } } }; diff --git a/clap_builder/src/builder/value_parser.rs b/clap_builder/src/builder/value_parser.rs index 24631ce7c35..461309abafd 100644 --- a/clap_builder/src/builder/value_parser.rs +++ b/clap_builder/src/builder/value_parser.rs @@ -2382,17 +2382,17 @@ pub mod via_prelude { /// # use clap::ColorChoice; /// // Built-in types /// let parser = clap::value_parser!(String); -/// assert_eq!(format!("{:?}", parser), "ValueParser::string"); +/// assert_eq!(format!("{parser:?}"), "ValueParser::string"); /// let parser = clap::value_parser!(std::ffi::OsString); -/// assert_eq!(format!("{:?}", parser), "ValueParser::os_string"); +/// assert_eq!(format!("{parser:?}"), "ValueParser::os_string"); /// let parser = clap::value_parser!(std::path::PathBuf); -/// assert_eq!(format!("{:?}", parser), "ValueParser::path_buf"); +/// assert_eq!(format!("{parser:?}"), "ValueParser::path_buf"); /// clap::value_parser!(u16).range(3000..); /// clap::value_parser!(u64).range(3000..); /// /// // FromStr types /// let parser = clap::value_parser!(usize); -/// assert_eq!(format!("{:?}", parser), "_AnonymousValueParser(ValueParser::other(usize))"); +/// assert_eq!(format!("{parser:?}"), "_AnonymousValueParser(ValueParser::other(usize))"); /// /// // ValueEnum types /// clap::value_parser!(ColorChoice); diff --git a/clap_builder/src/error/mod.rs b/clap_builder/src/error/mod.rs index cb362966944..fa8e9e48454 100644 --- a/clap_builder/src/error/mod.rs +++ b/clap_builder/src/error/mod.rs @@ -275,7 +275,7 @@ impl Error { /// }, /// Err(err) => { /// let err = err.render(); - /// println!("{}", err); + /// println!("{err}"); /// // do_something /// }, /// }; diff --git a/clap_builder/src/macros.rs b/clap_builder/src/macros.rs index 59135e21252..713c083891d 100644 --- a/clap_builder/src/macros.rs +++ b/clap_builder/src/macros.rs @@ -175,8 +175,7 @@ macro_rules! arg_impl { debug_assert_eq!( ident_or_char_literal.len(), 1, - "Single-letter identifier expected, got {}", - ident_or_char_literal + "Single-letter identifier expected, got {ident_or_char_literal}", ); ident_or_char_literal.chars().next().unwrap() }}; @@ -404,7 +403,7 @@ macro_rules! arg_impl { $arg.action($crate::ArgAction::Count) } action => { - panic!("Unexpected action {:?}", action) + panic!("Unexpected action {action:?}") } }; let arg = $crate::arg_impl! { diff --git a/clap_builder/src/output/help_template.rs b/clap_builder/src/output/help_template.rs index 76009589a81..2016bc8808b 100644 --- a/clap_builder/src/output/help_template.rs +++ b/clap_builder/src/output/help_template.rs @@ -450,9 +450,10 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { } } } + /// Sorts arguments by length and display order and write their help to the wrapped stream. fn write_args(&mut self, args: &[&Arg], _category: &str, sort_key: ArgSortKey) { - debug!("HelpTemplate::write_args {}", _category); + debug!("HelpTemplate::write_args {_category}"); // The shortest an arg can legally be is 2 (i.e. '-x') let mut longest = 2; let mut ord_v = Vec::new(); @@ -577,8 +578,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { }; let spcs = longest + padding - self_len; debug!( - "HelpTemplate::align_to_about: positional=false arg_len={}, spaces={}", - self_len, spcs + "HelpTemplate::align_to_about: positional=false arg_len={self_len}, spaces={spcs}" ); spcs @@ -587,8 +587,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { let padding = TAB_WIDTH; let spcs = longest + padding - self_len; debug!( - "HelpTemplate::align_to_about: positional=true arg_len={}, spaces={}", - self_len, spcs + "HelpTemplate::align_to_about: positional=true arg_len={self_len}, spaces={spcs}", ); spcs @@ -612,7 +611,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { // Is help on next line, if so then indent if next_line_help { - debug!("HelpTemplate::help: Next Line...{:?}", next_line_help); + debug!("HelpTemplate::help: Next Line...{next_line_help:?}"); self.writer.push_str("\n"); self.writer.push_str(TAB); self.writer.push_str(NEXT_LINE_INDENT); @@ -659,10 +658,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { && !arg.is_hide_possible_values_set() && self.use_long_pv(arg) { - debug!( - "HelpTemplate::help: Found possible vals...{:?}", - possible_vals - ); + debug!("HelpTemplate::help: Found possible vals...{possible_vals:?}"); let longest = possible_vals .iter() .filter(|f| !f.is_hide_set()) @@ -741,7 +737,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { } fn spec_vals(&self, a: &Arg) -> String { - debug!("HelpTemplate::spec_vals: a={}", a); + debug!("HelpTemplate::spec_vals: a={a}"); let mut spec_vals = Vec::new(); #[cfg(feature = "env")] if let Some(ref env) = a.env { @@ -817,10 +813,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { let possible_vals = a.get_possible_values(); if !possible_vals.is_empty() && !a.is_hide_possible_values_set() && !self.use_long_pv(a) { - debug!( - "HelpTemplate::spec_vals: Found possible vals...{:?}", - possible_vals - ); + debug!("HelpTemplate::spec_vals: Found possible vals...{possible_vals:?}"); let pvs = possible_vals .iter() @@ -896,7 +889,7 @@ impl<'cmd, 'writer> HelpTemplate<'cmd, 'writer> { } ord_v.sort_by(|a, b| (a.0, &a.1).cmp(&(b.0, &b.1))); - debug!("HelpTemplate::write_subcommands longest = {}", longest); + debug!("HelpTemplate::write_subcommands longest = {longest}"); let next_line_help = self.will_subcommands_wrap(cmd.get_subcommands(), longest); diff --git a/clap_builder/src/output/textwrap/core.rs b/clap_builder/src/output/textwrap/core.rs index 25c9eb6b0e9..2f6004c7131 100644 --- a/clap_builder/src/output/textwrap/core.rs +++ b/clap_builder/src/output/textwrap/core.rs @@ -102,7 +102,7 @@ mod tests { let desc = format!("{:?} U+{:04X}", ch, ch as u32); #[cfg(feature = "unicode")] - assert_eq!(ch.width().unwrap(), 1, "char: {}", desc); + assert_eq!(ch.width().unwrap(), 1, "char: {desc}"); #[cfg(not(feature = "unicode"))] assert_eq!(ch_width(ch), 1, "char: {desc}"); @@ -120,7 +120,7 @@ mod tests { let desc = format!("{:?} U+{:04X}", ch, ch as u32); #[cfg(feature = "unicode")] - assert!(ch.width().unwrap() <= 2, "char: {}", desc); + assert!(ch.width().unwrap() <= 2, "char: {desc}"); #[cfg(not(feature = "unicode"))] assert_eq!(ch_width(ch), 1, "char: {desc}"); diff --git a/clap_builder/src/output/usage.rs b/clap_builder/src/output/usage.rs index 87bb945283d..3f387a0d71e 100644 --- a/clap_builder/src/output/usage.rs +++ b/clap_builder/src/output/usage.rs @@ -79,7 +79,7 @@ impl<'cmd> Usage<'cmd> { impl<'cmd> Usage<'cmd> { // Creates a usage string for display in help messages (i.e. not for errors) fn create_help_usage(&self, incl_reqs: bool) -> StyledStr { - debug!("Usage::create_help_usage; incl_reqs={:?}", incl_reqs); + debug!("Usage::create_help_usage; incl_reqs={incl_reqs:?}"); use std::fmt::Write as _; let literal = &self.styles.get_literal(); let placeholder = &self.styles.get_placeholder(); @@ -157,7 +157,7 @@ impl<'cmd> Usage<'cmd> { } } styled.trim(); - debug!("Usage::create_help_usage: usage={}", styled); + debug!("Usage::create_help_usage: usage={styled}"); styled } @@ -220,7 +220,7 @@ impl<'cmd> Usage<'cmd> { continue; } for grp_s in self.cmd.groups_for_arg(f.get_id()) { - debug!("Usage::needs_options_tag:iter:iter: grp_s={:?}", grp_s); + debug!("Usage::needs_options_tag:iter:iter: grp_s={grp_s:?}"); if self.cmd.get_groups().any(|g| g.id == grp_s && g.required) { debug!("Usage::needs_options_tag:iter:iter: Group is required"); continue 'outer; @@ -244,7 +244,7 @@ impl<'cmd> Usage<'cmd> { } pub(crate) fn get_args(&self, incls: &[Id], force_optional: bool) -> Vec { - debug!("Usage::get_args: incls={:?}", incls,); + debug!("Usage::get_args: incls={incls:?}",); use std::fmt::Write as _; let literal = &self.styles.get_literal(); @@ -275,7 +275,7 @@ impl<'cmd> Usage<'cmd> { // by unroll_requirements_for_arg. unrolled_reqs.push(a.clone()); } - debug!("Usage::get_args: unrolled_reqs={:?}", unrolled_reqs); + debug!("Usage::get_args: unrolled_reqs={unrolled_reqs:?}"); let mut required_groups_members = FlatSet::new(); let mut required_groups = FlatSet::new(); @@ -360,7 +360,7 @@ impl<'cmd> Usage<'cmd> { ret_val.push(pos); } - debug!("Usage::get_args: ret_val={:?}", ret_val); + debug!("Usage::get_args: ret_val={ret_val:?}"); ret_val } @@ -410,10 +410,7 @@ impl<'cmd> Usage<'cmd> { // by unroll_requirements_for_arg. unrolled_reqs.push(a.clone()); } - debug!( - "Usage::get_required_usage_from: unrolled_reqs={:?}", - unrolled_reqs - ); + debug!("Usage::get_required_usage_from: unrolled_reqs={unrolled_reqs:?}"); let mut required_groups_members = FlatSet::new(); let mut required_groups = FlatSet::new(); @@ -427,10 +424,7 @@ impl<'cmd> Usage<'cmd> { .any(|arg| m.check_explicit(arg, &ArgPredicate::IsPresent)) }) .unwrap_or(false); - debug!( - "Usage::get_required_usage_from:iter:{:?} group is_present={}", - req, is_present - ); + debug!("Usage::get_required_usage_from:iter:{req:?} group is_present={is_present}"); if is_present { continue; } @@ -454,10 +448,7 @@ impl<'cmd> Usage<'cmd> { let is_present = matcher .map(|m| m.check_explicit(req, &ArgPredicate::IsPresent)) .unwrap_or(false); - debug!( - "Usage::get_required_usage_from:iter:{:?} arg is_present={}", - req, is_present - ); + debug!("Usage::get_required_usage_from:iter:{req:?} arg is_present={is_present}"); if is_present { continue; } @@ -486,7 +477,7 @@ impl<'cmd> Usage<'cmd> { ret_val.push(pos); } - debug!("Usage::get_required_usage_from: ret_val={:?}", ret_val); + debug!("Usage::get_required_usage_from: ret_val={ret_val:?}"); ret_val } } diff --git a/clap_builder/src/parser/arg_matcher.rs b/clap_builder/src/parser/arg_matcher.rs index 124d46f5fa8..b8d827a5b8f 100644 --- a/clap_builder/src/parser/arg_matcher.rs +++ b/clap_builder/src/parser/arg_matcher.rs @@ -45,10 +45,7 @@ impl ArgMatcher { } pub(crate) fn propagate_globals(&mut self, global_arg_vec: &[Id]) { - debug!( - "ArgMatcher::get_global_values: global_arg_vec={:?}", - global_arg_vec - ); + debug!("ArgMatcher::get_global_values: global_arg_vec={global_arg_vec:?}"); let mut vals_map = FlatMap::new(); self.fill_in_global_values(global_arg_vec, &mut vals_map); } @@ -137,10 +134,7 @@ impl ArgMatcher { pub(crate) fn start_custom_arg(&mut self, arg: &Arg, source: ValueSource) { let id = arg.get_id().clone(); - debug!( - "ArgMatcher::start_custom_arg: id={:?}, source={:?}", - id, source - ); + debug!("ArgMatcher::start_custom_arg: id={id:?}, source={source:?}"); let ma = self.entry(id).or_insert(MatchedArg::new_arg(arg)); debug_assert_eq!(ma.type_id(), Some(arg.get_value_parser().type_id())); ma.set_source(source); @@ -148,10 +142,7 @@ impl ArgMatcher { } pub(crate) fn start_custom_group(&mut self, id: Id, source: ValueSource) { - debug!( - "ArgMatcher::start_custom_arg: id={:?}, source={:?}", - id, source - ); + debug!("ArgMatcher::start_custom_arg: id={id:?}, source={source:?}"); let ma = self.entry(id).or_insert(MatchedArg::new_group()); debug_assert_eq!(ma.type_id(), None); ma.set_source(source); @@ -160,7 +151,7 @@ impl ArgMatcher { pub(crate) fn start_occurrence_of_external(&mut self, cmd: &crate::Command) { let id = Id::from_static_ref(Id::EXTERNAL); - debug!("ArgMatcher::start_occurrence_of_external: id={:?}", id,); + debug!("ArgMatcher::start_occurrence_of_external: id={id:?}"); let ma = self.entry(id).or_insert(MatchedArg::new_external(cmd)); debug_assert_eq!( ma.type_id(), @@ -196,10 +187,7 @@ impl ArgMatcher { num_pending ); let expected = o.get_num_args().expect(INTERNAL_ERROR_MSG); - debug!( - "ArgMatcher::needs_more_vals: expected={}, actual={}", - expected, num_pending - ); + debug!("ArgMatcher::needs_more_vals: expected={expected}, actual={num_pending}"); expected.accepts_more(num_pending) } diff --git a/clap_builder/src/parser/matches/arg_matches.rs b/clap_builder/src/parser/matches/arg_matches.rs index 2fa52071db8..525904291ea 100644 --- a/clap_builder/src/parser/matches/arg_matches.rs +++ b/clap_builder/src/parser/matches/arg_matches.rs @@ -43,7 +43,7 @@ use crate::INTERNAL_ERROR_MSG; /// // to get information about the "cfg" argument we created, such as the value supplied we use /// // various ArgMatches methods, such as [ArgMatches::get_one] /// if let Some(c) = matches.get_one::("cfg") { -/// println!("Value for -c: {}", c); +/// println!("Value for -c: {c}"); /// } /// /// // The ArgMatches::get_one method returns an Option because the user may not have supplied @@ -924,7 +924,7 @@ impl ArgMatches { /// ("clone", sub_m) => {}, // clone was used /// ("push", sub_m) => {}, // push was used /// ("commit", sub_m) => {}, // commit was used - /// (name, _) => unimplemented!("{}", name), + /// (name, _) => unimplemented!("{name}"), /// } /// ``` /// diff --git a/clap_builder/src/parser/parser.rs b/clap_builder/src/parser/parser.rs index 723e1cd69a9..a96c0c77de3 100644 --- a/clap_builder/src/parser/parser.rs +++ b/clap_builder/src/parser/parser.rs @@ -88,7 +88,7 @@ impl<'cmd> Parser<'cmd> { { // Does the arg match a subcommand name, or any of its aliases (if defined) let sc_name = self.possible_subcommand(arg_os.to_value(), valid_arg_found); - debug!("Parser::get_matches_with: sc={:?}", sc_name); + debug!("Parser::get_matches_with: sc={sc_name:?}"); if let Some(sc_name) = sc_name { if sc_name == "help" && !self.cmd.is_disable_help_subcommand_set() { ok!(self.parse_help_subcommand(raw_args.remaining(&mut args_cursor))); @@ -120,10 +120,7 @@ impl<'cmd> Parser<'cmd> { pos_counter, &mut valid_arg_found, )); - debug!( - "Parser::get_matches_with: After parse_long_arg {:?}", - parse_result - ); + debug!("Parser::get_matches_with: After parse_long_arg {parse_result:?}"); match parse_result { ParseResult::NoArg => { unreachable!("`to_long` always has the flag specified") @@ -193,10 +190,7 @@ impl<'cmd> Parser<'cmd> { &mut valid_arg_found, )); // If it's None, we then check if one of those two AppSettings was set - debug!( - "Parser::get_matches_with: After parse_short_arg {:?}", - parse_result - ); + debug!("Parser::get_matches_with: After parse_short_arg {parse_result:?}"); match parse_result { ParseResult::NoArg => { // Is a single dash `-`, try positional. @@ -312,14 +306,8 @@ impl<'cmd> Parser<'cmd> { && is_second_to_last && !trailing_values; - debug!( - "Parser::get_matches_with: Positional counter...{}", - pos_counter - ); - debug!( - "Parser::get_matches_with: Low index multiples...{:?}", - low_index_mults - ); + debug!("Parser::get_matches_with: Positional counter...{pos_counter}"); + debug!("Parser::get_matches_with: Low index multiples...{low_index_mults:?}"); if low_index_mults || missing_pos { let skip_current = if let Some(n) = raw_args.peek(&args_cursor) { @@ -386,8 +374,7 @@ impl<'cmd> Parser<'cmd> { } if let Some(_parse_result) = self.check_terminator(arg, arg_os.to_value_os()) { debug!( - "Parser::get_matches_with: ignoring terminator result {:?}", - _parse_result + "Parser::get_matches_with: ignoring terminator result {_parse_result:?}" ); } else { let arg_values = matcher.pending_values_mut( @@ -535,7 +522,7 @@ impl<'cmd> Parser<'cmd> { arg: Result<&str, &OsStr>, valid_arg_found: bool, ) -> Option<&str> { - debug!("Parser::possible_subcommand: arg={:?}", arg); + debug!("Parser::possible_subcommand: arg={arg:?}"); let arg = some!(arg.ok()); if !(self.cmd.is_args_conflicts_with_subcommands_set() && valid_arg_found) { @@ -564,7 +551,7 @@ impl<'cmd> Parser<'cmd> { // Checks if the arg matches a long flag subcommand name, or any of its aliases (if defined) fn possible_long_flag_subcommand(&self, arg: &str) -> Option<&str> { - debug!("Parser::possible_long_flag_subcommand: arg={:?}", arg); + debug!("Parser::possible_long_flag_subcommand: arg={arg:?}"); if self.cmd.is_infer_subcommands_set() { let options = self .cmd @@ -687,10 +674,7 @@ impl<'cmd> Parser<'cmd> { } if let Err(error) = p.get_matches_with(&mut sc_matcher, raw_args, args_cursor) { if partial_parsing_enabled { - debug!( - "Parser::parse_subcommand: ignored error in subcommand {}: {:?}", - sc_name, error - ); + debug!("Parser::parse_subcommand: ignored error in subcommand {sc_name}: {error:?}"); } else { return Err(error); } @@ -741,7 +725,7 @@ impl<'cmd> Parser<'cmd> { } let arg = if let Some(arg) = self.cmd.get_keymap().get(long_arg) { - debug!("Parser::parse_long_arg: Found valid arg or flag '{}'", arg); + debug!("Parser::parse_long_arg: Found valid arg or flag '{arg}'"); Some((long_arg, arg)) } else if self.cmd.is_infer_long_args_set() { self.cmd.get_arguments().find_map(|a| { @@ -770,10 +754,7 @@ impl<'cmd> Parser<'cmd> { self.parse_opt_value(ident, long_value, arg, matcher, has_eq) } else if let Some(rest) = long_value { let required = self.cmd.required_graph(); - debug!( - "Parser::parse_long_arg({:?}): Got invalid literal `{:?}`", - long_arg, rest - ); + debug!("Parser::parse_long_arg({long_arg:?}): Got invalid literal `{rest:?}`"); let mut used: Vec = matcher .arg_ids() .filter(|arg_id| { @@ -795,7 +776,7 @@ impl<'cmd> Parser<'cmd> { arg: arg.to_string(), }) } else { - debug!("Parser::parse_long_arg({:?}): Presence validated", long_arg); + debug!("Parser::parse_long_arg({long_arg:?}): Presence validated"); let trailing_idx = None; self.react( Some(ident), @@ -815,10 +796,7 @@ impl<'cmd> Parser<'cmd> { .map(|arg| arg.is_allow_hyphen_values_set() && !arg.is_last_set()) .unwrap_or_default() { - debug!( - "Parser::parse_long_args: positional at {} allows hyphens", - pos_counter - ); + debug!("Parser::parse_long_args: positional at {pos_counter} allows hyphens"); Ok(ParseResult::MaybeHyphenValue) } else { Ok(ParseResult::NoMatchingArg { @@ -836,7 +814,7 @@ impl<'cmd> Parser<'cmd> { pos_counter: usize, valid_arg_found: &mut bool, ) -> ClapResult { - debug!("Parser::parse_short_arg: short_arg={:?}", short_arg); + debug!("Parser::parse_short_arg: short_arg={short_arg:?}"); #[allow(clippy::blocks_in_if_conditions)] if matches!(parse_state, ParseState::Opt(opt) | ParseState::Pos(opt) @@ -864,10 +842,7 @@ impl<'cmd> Parser<'cmd> { .clone() .any(|c| !c.map(|c| self.cmd.contains_short(c)).unwrap_or_default()) { - debug!( - "Parser::parse_short_args: positional at {} allows hyphens", - pos_counter - ); + debug!("Parser::parse_short_args: positional at {pos_counter} allows hyphens"); return Ok(ParseResult::MaybeHyphenValue); } @@ -890,7 +865,7 @@ impl<'cmd> Parser<'cmd> { }); } }; - debug!("Parser::parse_short_arg:iter:{}", c); + debug!("Parser::parse_short_arg:iter:{c}"); // Check for matching short options, and return the name if there is no trailing // concatenated value: -oval @@ -898,10 +873,7 @@ impl<'cmd> Parser<'cmd> { // Value: val if let Some(arg) = self.cmd.get_keymap().get(&c) { let ident = Identifier::Short; - debug!( - "Parser::parse_short_arg:iter:{}: Found valid opt or flag", - c - ); + debug!("Parser::parse_short_arg:iter:{c}: Found valid opt or flag"); *valid_arg_found = true; if !arg.is_takes_value_set() { let arg_values = Vec::new(); @@ -921,10 +893,7 @@ impl<'cmd> Parser<'cmd> { // // Cloning the iterator, so we rollback if it isn't there. let val = short_arg.clone().next_value_os().unwrap_or_default(); - debug!( - "Parser::parse_short_arg:iter:{}: val={:?}, short_arg={:?}", - c, val, short_arg - ); + debug!("Parser::parse_short_arg:iter:{c}: val={val:?}, short_arg={short_arg:?}"); let val = Some(val).filter(|v| !v.is_empty()); // Default to "we're expecting a value later". @@ -946,7 +915,7 @@ impl<'cmd> Parser<'cmd> { } return if let Some(sc_name) = self.cmd.find_short_subcmd(c) { - debug!("Parser::parse_short_arg:iter:{}: subcommand={}", c, sc_name); + debug!("Parser::parse_short_arg:iter:{c}: subcommand={sc_name}"); // Make sure indices get updated before reading `self.cur_idx` ok!(self.resolve_pending(matcher)); self.cur_idx.set(self.cur_idx.get() + 1); @@ -1053,7 +1022,7 @@ impl<'cmd> Parser<'cmd> { raw_vals: Vec, matcher: &mut ArgMatcher, ) -> ClapResult<()> { - debug!("Parser::push_arg_values: {:?}", raw_vals); + debug!("Parser::push_arg_values: {raw_vals:?}"); for raw_val in raw_vals { // update the current index because each value is a distinct index to clap @@ -1262,7 +1231,7 @@ impl<'cmd> Parser<'cmd> { Some(Identifier::Index) => true, None => true, }; - debug!("Help: use_long={}", use_long); + debug!("Help: use_long={use_long}"); Err(self.help_err(use_long)) } ArgAction::Version => { @@ -1272,7 +1241,7 @@ impl<'cmd> Parser<'cmd> { Some(Identifier::Index) => true, None => true, }; - debug!("Version: use_long={}", use_long); + debug!("Version: use_long={use_long}"); Err(self.version_err(use_long)) } } @@ -1337,7 +1306,7 @@ impl<'cmd> Parser<'cmd> { fn remove_overrides(&self, arg: &Arg, matcher: &mut ArgMatcher) { debug!("Parser::remove_overrides: id={:?}", arg.id); for override_id in &arg.overrides { - debug!("Parser::remove_overrides:iter:{:?}: removing", override_id); + debug!("Parser::remove_overrides:iter:{override_id:?}: removing"); matcher.remove(override_id); } @@ -1351,7 +1320,7 @@ impl<'cmd> Parser<'cmd> { } } for overrider_id in transitive { - debug!("Parser::remove_overrides:iter:{:?}: removing", overrider_id); + debug!("Parser::remove_overrides:iter:{overrider_id:?}: removing"); matcher.remove(overrider_id); } } @@ -1364,13 +1333,13 @@ impl<'cmd> Parser<'cmd> { // Use env only if the arg was absent among command line args, // early return if this is not the case. if matcher.contains(&arg.id) { - debug!("Parser::add_env: Skipping existing arg `{}`", arg); + debug!("Parser::add_env: Skipping existing arg `{arg}`"); continue; } - debug!("Parser::add_env: Checking arg `{}`", arg); + debug!("Parser::add_env: Checking arg `{arg}`"); if let Some((_, Some(ref val))) = arg.env { - debug!("Parser::add_env: Found an opt with value={:?}", val); + debug!("Parser::add_env: Found an opt with value={val:?}"); let arg_values = vec![val.to_owned()]; let trailing_idx = None; let _ = ok!(self.react( @@ -1504,7 +1473,7 @@ impl<'cmd> Parser<'cmd> { remaining_args: &[&OsStr], trailing_values: bool, ) -> ClapError { - debug!("Parser::did_you_mean_error: arg={}", arg); + debug!("Parser::did_you_mean_error: arg={arg}"); // Didn't match a flag or option let longs = self .cmd @@ -1515,7 +1484,7 @@ impl<'cmd> Parser<'cmd> { _ => None, }) .collect::>(); - debug!("Parser::did_you_mean_error: longs={:?}", longs); + debug!("Parser::did_you_mean_error: longs={longs:?}"); let did_you_mean = suggestions::did_you_mean_flag( arg, diff --git a/clap_builder/src/parser/validator.rs b/clap_builder/src/parser/validator.rs index 5c3d34643ec..b95b73bfaea 100644 --- a/clap_builder/src/parser/validator.rs +++ b/clap_builder/src/parser/validator.rs @@ -31,7 +31,7 @@ impl<'cmd> Validator<'cmd> { let has_subcmd = matcher.subcommand_name().is_some(); if let ParseState::Opt(a) = parse_state { - debug!("Validator::validate: needs_val_of={:?}", a); + debug!("Validator::validate: needs_val_of={a:?}"); let o = &self.cmd[&a]; let should_err = if let Some(v) = matcher.args.get(o.get_id()) { @@ -102,7 +102,7 @@ impl<'cmd> Validator<'cmd> { .filter(|(_, matched)| matched.check_explicit(&ArgPredicate::IsPresent)) .filter(|(arg_id, _)| self.cmd.find(arg_id).is_some()) { - debug!("Validator::validate_conflicts::iter: id={:?}", arg_id); + debug!("Validator::validate_conflicts::iter: id={arg_id:?}"); let conflicts = conflicts.gather_conflicts(self.cmd, arg_id); ok!(self.build_conflict_err(arg_id, &conflicts, matcher)); } @@ -130,7 +130,7 @@ impl<'cmd> Validator<'cmd> { .args() .filter(|(_, matched)| matched.check_explicit(&crate::builder::ArgPredicate::IsPresent)) .filter_map(|(id, _)| { - debug!("Validator::validate_exclusive:iter:{:?}", id); + debug!("Validator::validate_exclusive:iter:{id:?}"); self.cmd .find(id) // Find `arg`s which are exclusive but also appear with other args. @@ -159,7 +159,7 @@ impl<'cmd> Validator<'cmd> { return Ok(()); } - debug!("Validator::build_conflict_err: name={:?}", name); + debug!("Validator::build_conflict_err: name={name:?}"); let mut seen = FlatSet::new(); let conflicts = conflict_ids .iter() @@ -226,7 +226,7 @@ impl<'cmd> Validator<'cmd> { .args() .filter(|(_, matched)| matched.check_explicit(&ArgPredicate::IsPresent)) { - debug!("Validator::gather_requires:iter:{:?}", name); + debug!("Validator::gather_requires:iter:{name:?}"); if let Some(arg) = self.cmd.find(name) { let is_relevant = |(val, req_arg): &(ArgPredicate, Id)| -> Option { let required = matched.check_explicit(val); @@ -237,7 +237,7 @@ impl<'cmd> Validator<'cmd> { self.required.insert(req); } } else if let Some(g) = self.cmd.find_group(name) { - debug!("Validator::gather_requires:iter:{:?}:group", name); + debug!("Validator::gather_requires:iter:{name:?}:group"); for r in &g.requires { self.required.insert(r.clone()); } @@ -261,17 +261,14 @@ impl<'cmd> Validator<'cmd> { .map(|arg| arg.is_exclusive_set()) .unwrap_or_default() }); - debug!( - "Validator::validate_required: is_exclusive_present={}", - is_exclusive_present - ); + debug!("Validator::validate_required: is_exclusive_present={is_exclusive_present}"); for arg_or_group in self .required .iter() .filter(|r| !matcher.check_explicit(r, &ArgPredicate::IsPresent)) { - debug!("Validator::validate_required:iter:aog={:?}", arg_or_group); + debug!("Validator::validate_required:iter:aog={arg_or_group:?}"); if let Some(arg) = self.cmd.find(arg_or_group) { debug!("Validator::validate_required:iter: This is an arg"); if !is_exclusive_present && !self.is_missing_required_ok(arg, conflicts) { @@ -380,7 +377,7 @@ impl<'cmd> Validator<'cmd> { } for group_id in self.cmd.groups_for_arg(a.get_id()) { if !conflicts.gather_conflicts(self.cmd, &group_id).is_empty() { - debug!("Validator::is_missing_required_ok: true ({})", group_id); + debug!("Validator::is_missing_required_ok: true ({group_id})"); return true; } } @@ -402,7 +399,7 @@ impl<'cmd> Validator<'cmd> { matcher: &ArgMatcher, raw_req_args: Vec, ) -> ClapResult<()> { - debug!("Validator::missing_required_error; incl={:?}", raw_req_args); + debug!("Validator::missing_required_error; incl={raw_req_args:?}"); debug!( "Validator::missing_required_error: reqs={:?}", self.required @@ -429,7 +426,7 @@ impl<'cmd> Validator<'cmd> { } else if let Some(_group) = self.cmd.find_group(id) { self.cmd.format_group(id).to_string() } else { - debug_assert!(false, "id={:?} is unknown", id); + debug_assert!(false, "id={id:?} is unknown"); "".to_owned() } }) @@ -437,10 +434,7 @@ impl<'cmd> Validator<'cmd> { } }; - debug!( - "Validator::missing_required_error: req_args={:#?}", - req_args - ); + debug!("Validator::missing_required_error: req_args={req_args:#?}"); let used: Vec = matcher .args() @@ -486,7 +480,7 @@ impl Conflicts { } fn gather_conflicts(&self, cmd: &Command, arg_id: &Id) -> Vec { - debug!("Conflicts::gather_conflicts: arg={:?}", arg_id); + debug!("Conflicts::gather_conflicts: arg={arg_id:?}"); let mut conflicts = Vec::new(); let arg_id_conflicts_storage; @@ -510,7 +504,7 @@ impl Conflicts { } } - debug!("Conflicts::gather_conflicts: conflicts={:?}", conflicts); + debug!("Conflicts::gather_conflicts: conflicts={conflicts:?}"); conflicts } diff --git a/clap_complete/examples/dynamic.rs b/clap_complete/examples/dynamic.rs index 5abf2de1f81..5f1f30acd24 100644 --- a/clap_complete/examples/dynamic.rs +++ b/clap_complete/examples/dynamic.rs @@ -27,7 +27,7 @@ fn main() { { completions.complete(&mut command()); } else { - println!("{:#?}", matches); + println!("{matches:#?}"); } } diff --git a/clap_complete/src/dynamic.rs b/clap_complete/src/dynamic.rs index 76cede2a6c0..f25b4a48df8 100644 --- a/clap_complete/src/dynamic.rs +++ b/clap_complete/src/dynamic.rs @@ -71,7 +71,7 @@ pub mod bash { /// Process the completion request pub fn try_complete(&self, cmd: &mut clap::Command) -> clap::error::Result<()> { - debug!("CompleteCommand::try_complete: {:?}", self); + debug!("CompleteCommand::try_complete: {self:?}"); let CompleteCommand::Complete(args) = self; if let Some(out_path) = args.register.as_deref() { let mut buf = Vec::new(); @@ -124,7 +124,7 @@ pub mod bash { /// The recommended file name for the registration code pub fn file_name(name: &str) -> String { - format!("{}.bash", name) + format!("{name}.bash") } /// Define the completion behavior @@ -154,8 +154,7 @@ pub mod bash { let escaped_name = name.replace('-', "_"); debug_assert!( escaped_name.chars().all(|c| c.is_xid_continue()), - "`name` must be an identifier, got `{}`", - escaped_name + "`name` must be an identifier, got `{escaped_name}`" ); let mut upper_name = escaped_name.clone(); upper_name.make_ascii_uppercase(); @@ -201,7 +200,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES .replace("COMPLETER", &completer) .replace("UPPER", &upper_name); - writeln!(buf, "{}", script)?; + writeln!(buf, "{script}")?; Ok(()) } @@ -386,7 +385,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES crate::generator::utils::longs_and_visible_aliases(cmd) .into_iter() .filter_map(|f| { - f.starts_with(flag).then(|| format!("--{}", f).into()) + f.starts_with(flag).then(|| format!("--{f}").into()) }), ); } @@ -396,7 +395,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES completions.extend( crate::generator::utils::longs_and_visible_aliases(cmd) .into_iter() - .map(|f| format!("--{}", f).into()), + .map(|f| format!("--{f}").into()), ); } @@ -431,7 +430,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES current_dir: Option<&std::path::Path>, ) -> Vec { let mut values = Vec::new(); - debug!("complete_arg_value: arg={:?}, value={:?}", arg, value); + debug!("complete_arg_value: arg={arg:?}, value={value:?}"); if let Some(possible_values) = crate::generator::utils::possible_values(arg) { if let Ok(value) = value { @@ -500,7 +499,7 @@ complete OPTIONS -F _clap_complete_NAME EXECUTABLES .split_once("\\") .unwrap_or((OsStr::new(""), value_os)); let root = current_dir.join(existing); - debug!("complete_path: root={:?}, prefix={:?}", root, prefix); + debug!("complete_path: root={root:?}, prefix={prefix:?}"); let prefix = prefix.to_string_lossy(); for entry in std::fs::read_dir(&root) diff --git a/clap_complete/src/generator/mod.rs b/clap_complete/src/generator/mod.rs index 0c52b85dfec..c6e5c5ec81d 100644 --- a/clap_complete/src/generator/mod.rs +++ b/clap_complete/src/generator/mod.rs @@ -29,7 +29,7 @@ pub trait Generator { /// /// impl Generator for Fish { /// fn file_name(&self, name: &str) -> String { - /// format!("{}.fish", name) + /// format!("{name}.fish") /// } /// # fn generate(&self, cmd: &Command, buf: &mut dyn Write) {} /// } @@ -59,7 +59,7 @@ pub trait Generator { /// # name.into() /// # } /// fn generate(&self, cmd: &Command, buf: &mut dyn Write) { - /// write!(buf, "{}", cmd).unwrap(); + /// write!(buf, "{cmd}").unwrap(); /// } /// } /// ``` @@ -150,7 +150,7 @@ pub trait Generator { /// outdir, // We need to specify where to write to /// )?; /// -/// println!("cargo:warning=completion file is generated: {:?}", path); +/// println!("cargo:warning=completion file is generated: {path:?}"); /// /// Ok(()) /// } diff --git a/clap_complete/src/lib.rs b/clap_complete/src/lib.rs index 80fead4a557..a44288220e7 100644 --- a/clap_complete/src/lib.rs +++ b/clap_complete/src/lib.rs @@ -49,7 +49,7 @@ //! //! if let Some(generator) = matches.get_one::("generator").copied() { //! let mut cmd = build_cli(); -//! eprintln!("Generating completion file for {}...", generator); +//! eprintln!("Generating completion file for {generator}..."); //! print_completions(generator, &mut cmd); //! } //! } diff --git a/clap_complete/src/shells/bash.rs b/clap_complete/src/shells/bash.rs index b66634098f6..139e2fc73ff 100644 --- a/clap_complete/src/shells/bash.rs +++ b/clap_complete/src/shells/bash.rs @@ -158,7 +158,7 @@ fn subcommand_details(cmd: &Command) -> String { } fn option_details_for_path(cmd: &Command, path: &str) -> String { - debug!("option_details_for_path: path={}", path); + debug!("option_details_for_path: path={path}"); let p = utils::find_subcommand_with_path(cmd, path.split("__").skip(1).collect()); let mut opts = vec![String::new()]; @@ -212,7 +212,7 @@ fn vals_for(o: &Arg) -> String { } fn all_options_for_path(cmd: &Command, path: &str) -> String { - debug!("all_options_for_path: path={}", path); + debug!("all_options_for_path: path={path}"); let p = utils::find_subcommand_with_path(cmd, path.split("__").skip(1).collect()); diff --git a/clap_complete/src/shells/fish.rs b/clap_complete/src/shells/fish.rs index 77a72f7ebde..5a069d35b56 100644 --- a/clap_complete/src/shells/fish.rs +++ b/clap_complete/src/shells/fish.rs @@ -80,7 +80,7 @@ fn gen_fish_inner( ); } - debug!("gen_fish_inner: parent_commands={:?}", parent_commands); + debug!("gen_fish_inner: parent_commands={parent_commands:?}"); for option in cmd.get_opts() { let mut template = basic_template.clone(); diff --git a/clap_complete/src/shells/powershell.rs b/clap_complete/src/shells/powershell.rs index df31bfafabe..417facf70c2 100644 --- a/clap_complete/src/shells/powershell.rs +++ b/clap_complete/src/shells/powershell.rs @@ -95,11 +95,8 @@ fn generate_inner(p: &Command, previous_command_name: &str) -> String { completions.push_str(&preamble); completions.push_str( - format!( - "'{}', '{}', {}, '{}')", - data, data, "[CompletionResultType]::ParameterValue", tooltip - ) - .as_str(), + format!("'{data}', '{data}', [CompletionResultType]::ParameterValue, '{tooltip}')") + .as_str(), ); } diff --git a/clap_complete/src/shells/zsh.rs b/clap_complete/src/shells/zsh.rs index 9c91af00a39..71c586d8e1c 100644 --- a/clap_complete/src/shells/zsh.rs +++ b/clap_complete/src/shells/zsh.rs @@ -657,7 +657,7 @@ fn write_positionals_of(p: &Command) -> String { value_completion = value_completion(arg).unwrap_or_default() ); - debug!("write_positionals_of:iter: Wrote...{}", a); + debug!("write_positionals_of:iter: Wrote...{a}"); ret.push(a); } diff --git a/clap_complete_fig/src/fig.rs b/clap_complete_fig/src/fig.rs index 07fb8a136c8..16f2f7ec7e6 100644 --- a/clap_complete_fig/src/fig.rs +++ b/clap_complete_fig/src/fig.rs @@ -53,7 +53,7 @@ fn escape_string(string: &str) -> String { fn gen_fig_inner(parent_commands: &[&str], indent: usize, cmd: &Command, buffer: &mut String) { if cmd.has_subcommands() { - write!(buffer, "{:indent$}subcommands: [\n", "", indent = indent).unwrap(); + write!(buffer, "{:indent$}subcommands: [\n", "").unwrap(); // generate subcommands for subcommand in cmd.get_subcommands() { let mut aliases: Vec<&str> = subcommand.get_all_aliases().collect(); @@ -111,7 +111,7 @@ fn gen_fig_inner(parent_commands: &[&str], indent: usize, cmd: &Command, buffer: write!(buffer, "{:indent$}}},\n", "", indent = indent + 2).unwrap(); } - write!(buffer, "{:indent$}],\n", "", indent = indent).unwrap(); + write!(buffer, "{:indent$}],\n", "").unwrap(); } buffer.push_str(&gen_options(cmd, indent)); @@ -121,17 +121,17 @@ fn gen_fig_inner(parent_commands: &[&str], indent: usize, cmd: &Command, buffer: match args.len() { 0 => {} 1 => { - write!(buffer, "{:indent$}args: ", "", indent = indent).unwrap(); + write!(buffer, "{:indent$}args: ", "").unwrap(); buffer.push_str(&gen_args(args[0], indent)); } _ => { - write!(buffer, "{:indent$}args: [\n", "", indent = indent).unwrap(); + write!(buffer, "{:indent$}args: [\n", "").unwrap(); for arg in args { write!(buffer, "{:indent$}", "", indent = indent + 2).unwrap(); buffer.push_str(&gen_args(arg, indent + 2)); } - write!(buffer, "{:indent$}]\n", "", indent = indent).unwrap(); + write!(buffer, "{:indent$}]\n", "").unwrap(); } }; } @@ -142,7 +142,7 @@ fn gen_options(cmd: &Command, indent: usize) -> String { let flags = generator::utils::flags(cmd); if cmd.get_opts().next().is_some() || !flags.is_empty() { - write!(&mut buffer, "{:indent$}options: [\n", "", indent = indent).unwrap(); + write!(&mut buffer, "{:indent$}options: [\n", "").unwrap(); for option in cmd.get_opts() { write!(&mut buffer, "{:indent$}{{\n", "", indent = indent + 2).unwrap(); @@ -346,7 +346,7 @@ fn gen_options(cmd: &Command, indent: usize) -> String { write!(&mut buffer, "{:indent$}}},\n", "", indent = indent + 2).unwrap(); } - write!(&mut buffer, "{:indent$}],\n", "", indent = indent).unwrap(); + write!(&mut buffer, "{:indent$}],\n", "").unwrap(); } buffer @@ -467,7 +467,7 @@ fn gen_args(arg: &Arg, indent: usize) -> String { }; }; - write!(&mut buffer, "{:indent$}}},\n", "", indent = indent).unwrap(); + write!(&mut buffer, "{:indent$}}},\n", "").unwrap(); buffer } diff --git a/clap_derive/src/item.rs b/clap_derive/src/item.rs index 71a9e968dab..f3631fa7f09 100644 --- a/clap_derive/src/item.rs +++ b/clap_derive/src/item.rs @@ -908,7 +908,7 @@ impl Item { if !lines.is_empty() { let (short_help, long_help) = format_doc_comment(&lines, !self.verbatim_doc_comment, self.force_long_help); - let short_name = format_ident!("{}", short_name); + let short_name = format_ident!("{short_name}"); let short = Method::new( short_name, short_help @@ -917,7 +917,7 @@ impl Item { ); self.doc_comment.push(short); if let Some(long_name) = long_name { - let long_name = format_ident!("{}", long_name); + let long_name = format_ident!("{long_name}"); let long = Method::new( long_name, long_help @@ -946,7 +946,7 @@ impl Item { (_, _) => { let old = self.kind.name(); let new = kind.name(); - abort!(kind.span(), "`{}` cannot be used with `{}`", new, old); + abort!(kind.span(), "`{new}` cannot be used with `{old}`"); } } Ok(()) @@ -1405,7 +1405,7 @@ impl CasingStyle { "lower" | "lowercase" => cs(Lower), "upper" | "uppercase" => cs(Upper), "verbatim" | "verbatimcase" => cs(Verbatim), - s => abort!(name, "unsupported casing: `{}`", s), + s => abort!(name, "unsupported casing: `{s}`"), }; Ok(s) } diff --git a/clap_lex/src/lib.rs b/clap_lex/src/lib.rs index b349fba51d0..d519a10c562 100644 --- a/clap_lex/src/lib.rs +++ b/clap_lex/src/lib.rs @@ -40,7 +40,7 @@ //! Ok(Color::Never) //! } //! Some(invalid) => { -//! Err(format!("Invalid value for `--color`, {:?}", invalid).into()) +//! Err(format!("Invalid value for `--color`, {invalid:?}").into()) //! } //! } //! } @@ -67,7 +67,7 @@ //! match long { //! Ok("verbose") => { //! if let Some(value) = value { -//! return Err(format!("`--verbose` does not take a value, got `{:?}`", value).into()); +//! return Err(format!("`--verbose` does not take a value, got `{value:?}`").into()); //! } //! args.verbosity += 1; //! } @@ -91,7 +91,7 @@ //! args.color = Color::parse(value)?; //! } //! Ok(c) => { -//! return Err(format!("Unexpected flag: -{}", c).into()); +//! return Err(format!("Unexpected flag: -{c}").into()); //! } //! Err(e) => { //! return Err(format!("Unexpected flag: -{}", e.to_string_lossy()).into()); @@ -107,7 +107,7 @@ //! } //! //! let args = parse_args(["bin", "--hello", "world"]); -//! println!("{:?}", args); +//! println!("{args:?}"); //! ``` mod ext; @@ -139,7 +139,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn from_args() -> Self { Self::new(std::env::args_os()) @@ -156,7 +156,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn new(iter: impl IntoIterator>) -> Self { let iter = iter.into_iter(); @@ -174,7 +174,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn cursor(&self) -> ArgCursor { ArgCursor::new() @@ -213,7 +213,7 @@ impl RawArgs { /// let _bin = raw.next_os(&mut cursor); /// /// let mut paths = raw.remaining(&mut cursor).map(PathBuf::from).collect::>(); - /// println!("{:?}", paths); + /// println!("{paths:?}"); /// ``` pub fn remaining(&self, cursor: &mut ArgCursor) -> impl Iterator { let remaining = self.items[cursor.cursor..].iter().map(|s| s.as_os_str()); diff --git a/examples/cargo-example.rs b/examples/cargo-example.rs index b0861a630cd..11733651440 100644 --- a/examples/cargo-example.rs +++ b/examples/cargo-example.rs @@ -14,5 +14,5 @@ fn main() { _ => unreachable!("clap should ensure we don't get here"), }; let manifest_path = matches.get_one::("manifest-path"); - println!("{:?}", manifest_path); + println!("{manifest_path:?}"); } diff --git a/examples/find.rs b/examples/find.rs index e073e702d99..0b7f2c70000 100644 --- a/examples/find.rs +++ b/examples/find.rs @@ -5,7 +5,7 @@ use clap::{arg, command, ArgGroup, ArgMatches, Command}; fn main() { let matches = cli().get_matches(); let values = Value::from_matches(&matches); - println!("{:#?}", values); + println!("{values:#?}"); } fn cli() -> Command { @@ -51,7 +51,7 @@ impl Value { if Self::extract::(matches, id, &mut values) { continue; } - unimplemented!("unknown type for {}: {:?}", id, matches); + unimplemented!("unknown type for {id}: {matches:?}"); } values.into_values().collect::>() } diff --git a/examples/git.rs b/examples/git.rs index bd05e531582..02173675f9c 100644 --- a/examples/git.rs +++ b/examples/git.rs @@ -118,7 +118,7 @@ fn main() { println!("Pushing {message:?}"); } (name, _) => { - unreachable!("Unsupported subcommand `{}`", name) + unreachable!("Unsupported subcommand `{name}`") } } } diff --git a/examples/repl.rs b/examples/repl.rs index 2806ac8e9d4..d0baaed8d20 100644 --- a/examples/repl.rs +++ b/examples/repl.rs @@ -41,7 +41,7 @@ fn respond(line: &str) -> Result { std::io::stdout().flush().map_err(|e| e.to_string())?; return Ok(true); } - Some((name, _matches)) => unimplemented!("{}", name), + Some((name, _matches)) => unimplemented!("{name}"), None => unreachable!("subcommand required"), } diff --git a/examples/tutorial_builder/01_quick.rs b/examples/tutorial_builder/01_quick.rs index 8126e335e7f..328ce551991 100644 --- a/examples/tutorial_builder/01_quick.rs +++ b/examples/tutorial_builder/01_quick.rs @@ -25,7 +25,7 @@ fn main() { // You can check the value provided by positional arguments, or option arguments if let Some(name) = matches.get_one::("name") { - println!("Value for name: {}", name); + println!("Value for name: {name}"); } if let Some(config_path) = matches.get_one::("config") { diff --git a/examples/tutorial_builder/04_01_enum.rs b/examples/tutorial_builder/04_01_enum.rs index 1afa018a1a4..aa9f41ce6d4 100644 --- a/examples/tutorial_builder/04_01_enum.rs +++ b/examples/tutorial_builder/04_01_enum.rs @@ -38,7 +38,7 @@ impl std::str::FromStr for Mode { return Ok(*variant); } } - Err(format!("invalid variant: {}", s)) + Err(format!("invalid variant: {s}")) } } diff --git a/examples/tutorial_builder/04_02_parse.rs b/examples/tutorial_builder/04_02_parse.rs index 13f41a18e31..a3f79040d72 100644 --- a/examples/tutorial_builder/04_02_parse.rs +++ b/examples/tutorial_builder/04_02_parse.rs @@ -13,5 +13,5 @@ fn main() { let port: u16 = *matches .get_one::("PORT") .expect("'PORT' is required and parsing will fail if its missing"); - println!("PORT = {}", port); + println!("PORT = {port}"); } diff --git a/examples/tutorial_builder/04_02_validate.rs b/examples/tutorial_builder/04_02_validate.rs index 4690e8e1239..0ce53d65447 100644 --- a/examples/tutorial_builder/04_02_validate.rs +++ b/examples/tutorial_builder/04_02_validate.rs @@ -15,7 +15,7 @@ fn main() { let port: u16 = *matches .get_one::("PORT") .expect("'PORT' is required and parsing will fail if its missing"); - println!("PORT = {}", port); + println!("PORT = {port}"); } const PORT_RANGE: RangeInclusive = 1..=65535; @@ -23,7 +23,7 @@ const PORT_RANGE: RangeInclusive = 1..=65535; fn port_in_range(s: &str) -> Result { let port: usize = s .parse() - .map_err(|_| format!("`{}` isn't a port number", s))?; + .map_err(|_| format!("`{s}` isn't a port number"))?; if PORT_RANGE.contains(&port) { Ok(port as u16) } else { diff --git a/examples/tutorial_builder/04_03_relations.rs b/examples/tutorial_builder/04_03_relations.rs index 9d2d3d8d915..935e7a334c3 100644 --- a/examples/tutorial_builder/04_03_relations.rs +++ b/examples/tutorial_builder/04_03_relations.rs @@ -58,10 +58,10 @@ fn main() { (_, _, true) => patch += 1, _ => unreachable!(), }; - format!("{}.{}.{}", major, minor, patch) + format!("{major}.{minor}.{patch}") }; - println!("Version: {}", version); + println!("Version: {version}"); // Check for usage of -c if matches.contains_id("config") { diff --git a/examples/tutorial_builder/04_04_custom.rs b/examples/tutorial_builder/04_04_custom.rs index ebbae67dc0f..840b3aa4f71 100644 --- a/examples/tutorial_builder/04_04_custom.rs +++ b/examples/tutorial_builder/04_04_custom.rs @@ -57,10 +57,10 @@ fn main() { .exit(); } }; - format!("{}.{}.{}", major, minor, patch) + format!("{major}.{minor}.{patch}") }; - println!("Version: {}", version); + println!("Version: {version}"); // Check for usage of -c if matches.contains_id("config") { diff --git a/examples/tutorial_builder/05_01_assert.rs b/examples/tutorial_builder/05_01_assert.rs index 90c0a638316..b42c5762e76 100644 --- a/examples/tutorial_builder/05_01_assert.rs +++ b/examples/tutorial_builder/05_01_assert.rs @@ -7,7 +7,7 @@ fn main() { let port: usize = *matches .get_one::("PORT") .expect("'PORT' is required and parsing will fail if its missing"); - println!("PORT = {}", port); + println!("PORT = {port}"); } fn cmd() -> clap::Command { diff --git a/tests/builder/conflicts.rs b/tests/builder/conflicts.rs index 971e51b6c9c..00011844136 100644 --- a/tests/builder/conflicts.rs +++ b/tests/builder/conflicts.rs @@ -121,17 +121,17 @@ fn arg_conflicts_with_group() { let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--other"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--flag"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } } @@ -149,17 +149,17 @@ fn arg_conflicts_with_group_with_multiple_sources() { let result = cmd.try_get_matches_from_mut(vec!["myprog", "-f"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some", "usb1"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some", "usb1", "--other", "40"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "-f", "--some", "usb1"]); @@ -192,17 +192,17 @@ fn group_conflicts_with_arg() { let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--other"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--flag"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } } @@ -226,12 +226,12 @@ fn arg_conflicts_with_required_group() { let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--other"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } } @@ -255,12 +255,12 @@ fn arg_conflicts_with_group_with_required_memeber() { let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--flag"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } } @@ -290,12 +290,12 @@ fn required_group_conflicts_with_arg() { let result = cmd.try_get_matches_from_mut(vec!["myprog", "--some"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } let result = cmd.try_get_matches_from_mut(vec!["myprog", "--other"]); if let Err(err) = result { - panic!("{}", err); + panic!("{err}"); } } diff --git a/tests/builder/multiple_values.rs b/tests/builder/multiple_values.rs index 8def2e84ca3..702e8667d95 100644 --- a/tests/builder/multiple_values.rs +++ b/tests/builder/multiple_values.rs @@ -1531,7 +1531,7 @@ fn values_per_occurrence_named() { ]); let m = match m { Ok(m) => m, - Err(err) => panic!("{}", err), + Err(err) => panic!("{err}"), }; assert_eq!( m.get_many::("pos") diff --git a/tests/derive_ui/bool_value_enum.rs b/tests/derive_ui/bool_value_enum.rs index 7261e50d810..9d2dd40a2f5 100644 --- a/tests/derive_ui/bool_value_enum.rs +++ b/tests/derive_ui/bool_value_enum.rs @@ -9,5 +9,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/clap_empty_attr.rs b/tests/derive_ui/clap_empty_attr.rs index 101129f455b..d25915d3b5b 100644 --- a/tests/derive_ui/clap_empty_attr.rs +++ b/tests/derive_ui/clap_empty_attr.rs @@ -12,5 +12,5 @@ struct Opt1 { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/default_value_t_invalid.rs b/tests/derive_ui/default_value_t_invalid.rs index 010babdbd3e..584d9b99135 100644 --- a/tests/derive_ui/default_value_t_invalid.rs +++ b/tests/derive_ui/default_value_t_invalid.rs @@ -17,5 +17,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/default_values_t_invalid.rs b/tests/derive_ui/default_values_t_invalid.rs index 484051556a3..028c83a85f0 100644 --- a/tests/derive_ui/default_values_t_invalid.rs +++ b/tests/derive_ui/default_values_t_invalid.rs @@ -9,5 +9,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/enum_flatten.rs b/tests/derive_ui/enum_flatten.rs index b4f49cf36f5..71546c52e7f 100644 --- a/tests/derive_ui/enum_flatten.rs +++ b/tests/derive_ui/enum_flatten.rs @@ -17,5 +17,5 @@ enum Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/flatten_and_methods.rs b/tests/derive_ui/flatten_and_methods.rs index 137fa5ebe08..e0859697c77 100644 --- a/tests/derive_ui/flatten_and_methods.rs +++ b/tests/derive_ui/flatten_and_methods.rs @@ -25,5 +25,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/group_name_attribute.rs b/tests/derive_ui/group_name_attribute.rs index 059fc8921a5..e4442715e78 100644 --- a/tests/derive_ui/group_name_attribute.rs +++ b/tests/derive_ui/group_name_attribute.rs @@ -19,5 +19,5 @@ struct Source { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/multiple_external_subcommand.rs b/tests/derive_ui/multiple_external_subcommand.rs index 7b270831692..d36962d3f3d 100644 --- a/tests/derive_ui/multiple_external_subcommand.rs +++ b/tests/derive_ui/multiple_external_subcommand.rs @@ -17,5 +17,5 @@ enum Command { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/non_existent_attr.rs b/tests/derive_ui/non_existent_attr.rs index b3e3528eca8..d7322eb6e54 100644 --- a/tests/derive_ui/non_existent_attr.rs +++ b/tests/derive_ui/non_existent_attr.rs @@ -17,5 +17,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/rename_all_wrong_casing.rs b/tests/derive_ui/rename_all_wrong_casing.rs index 846891bc78c..a64032f7d35 100644 --- a/tests/derive_ui/rename_all_wrong_casing.rs +++ b/tests/derive_ui/rename_all_wrong_casing.rs @@ -17,5 +17,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/skip_flatten.rs b/tests/derive_ui/skip_flatten.rs index c38667fbecf..b74981f6de0 100644 --- a/tests/derive_ui/skip_flatten.rs +++ b/tests/derive_ui/skip_flatten.rs @@ -38,5 +38,5 @@ impl Default for Command { fn main() { let opt = MakeCookie::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/skip_subcommand.rs b/tests/derive_ui/skip_subcommand.rs index 1ca8fe50446..c7094411044 100644 --- a/tests/derive_ui/skip_subcommand.rs +++ b/tests/derive_ui/skip_subcommand.rs @@ -38,5 +38,5 @@ impl Default for Command { fn main() { let opt = MakeCookie::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/skip_with_other_options.rs b/tests/derive_ui/skip_with_other_options.rs index 63cdac73c1c..1f7cc022117 100644 --- a/tests/derive_ui/skip_with_other_options.rs +++ b/tests/derive_ui/skip_with_other_options.rs @@ -11,5 +11,5 @@ pub struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/skip_without_default.rs b/tests/derive_ui/skip_without_default.rs index 1d381c79d0e..a605eb8729e 100644 --- a/tests/derive_ui/skip_without_default.rs +++ b/tests/derive_ui/skip_without_default.rs @@ -25,5 +25,5 @@ pub struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/struct_subcommand.rs b/tests/derive_ui/struct_subcommand.rs index 91c2ab34548..c09eb9c863d 100644 --- a/tests/derive_ui/struct_subcommand.rs +++ b/tests/derive_ui/struct_subcommand.rs @@ -17,5 +17,5 @@ struct Opt { fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/subcommand_and_flatten.rs b/tests/derive_ui/subcommand_and_flatten.rs index d7b662ffcbd..5b7dfab189d 100644 --- a/tests/derive_ui/subcommand_and_flatten.rs +++ b/tests/derive_ui/subcommand_and_flatten.rs @@ -30,5 +30,5 @@ enum Command { fn main() { let opt = MakeCookie::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/subcommand_and_methods.rs b/tests/derive_ui/subcommand_and_methods.rs index b88422f671e..00ce589234d 100644 --- a/tests/derive_ui/subcommand_and_methods.rs +++ b/tests/derive_ui/subcommand_and_methods.rs @@ -30,5 +30,5 @@ enum Command { fn main() { let opt = MakeCookie::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/subcommand_opt_opt.rs b/tests/derive_ui/subcommand_opt_opt.rs index c16d443b01b..f9726e99ea4 100644 --- a/tests/derive_ui/subcommand_opt_opt.rs +++ b/tests/derive_ui/subcommand_opt_opt.rs @@ -30,5 +30,5 @@ enum Command { fn main() { let opt = MakeCookie::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/subcommand_opt_vec.rs b/tests/derive_ui/subcommand_opt_vec.rs index 58d3cd13ac6..b3daa83cd64 100644 --- a/tests/derive_ui/subcommand_opt_vec.rs +++ b/tests/derive_ui/subcommand_opt_vec.rs @@ -30,5 +30,5 @@ enum Command { fn main() { let opt = MakeCookie::parse(); - println!("{:?}", opt); + println!("{opt:?}"); } diff --git a/tests/derive_ui/tuple_struct.rs b/tests/derive_ui/tuple_struct.rs index 8a81481915c..5c1c1188dee 100644 --- a/tests/derive_ui/tuple_struct.rs +++ b/tests/derive_ui/tuple_struct.rs @@ -14,5 +14,5 @@ struct Opt(u32); fn main() { let opt = Opt::parse(); - println!("{:?}", opt); + println!("{opt:?}"); }