diff --git a/.clippy.toml b/.clippy.toml index 1d4c5dc66..a914f2b6a 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -10,3 +10,4 @@ disallowed-methods = [ { path = "std::iter::Iterator::for_each", reason = "prefer `for` for side-effects" }, { path = "std::iter::Iterator::try_for_each", reason = "prefer `for` for side-effects" }, ] +doc-valid-idents = ["PowerShell", ".."] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9aac9fbdf..72f527300 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: "1.92" # STABLE + toolchain: "1.93" # STABLE - uses: Swatinem/rust-cache@v2 - name: UI Tests run: make test-ui-${{ matrix.features }} @@ -210,7 +210,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: "1.92" # STABLE + toolchain: "1.93" # STABLE - uses: Swatinem/rust-cache@v2 - name: Check documentation env: @@ -225,7 +225,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: "1.92" # STABLE + toolchain: "1.93" # STABLE components: rustfmt - uses: Swatinem/rust-cache@v2 - name: Check formatting @@ -239,7 +239,7 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable with: - toolchain: "1.92" # STABLE + toolchain: "1.93" # STABLE components: clippy - uses: Swatinem/rust-cache@v2 - name: Lint (ultra-minimal) diff --git a/Makefile b/Makefile index 8fbc04a65..fffbae7b2 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ ifneq (${TOOLCHAIN_TARGET},) ARGS+=--target ${TOOLCHAIN_TARGET} endif -STABLE?=1.92 +STABLE?=1.93 _FEATURES = minimal default wasm full debug release _FEATURES_minimal = --no-default-features --features "std" diff --git a/clap_builder/src/builder/command.rs b/clap_builder/src/builder/command.rs index 70861ee49..b0d5bebd8 100644 --- a/clap_builder/src/builder/command.rs +++ b/clap_builder/src/builder/command.rs @@ -618,6 +618,7 @@ impl Command { /// println!("{}", m.get_flag("bar")); /// } /// ``` + #[allow(clippy::test_attr_in_doctest)] pub fn debug_assert(mut self) { self.build(); } diff --git a/clap_complete/src/engine/complete.rs b/clap_complete/src/engine/complete.rs index a5bdfed44..f6e638d86 100644 --- a/clap_complete/src/engine/complete.rs +++ b/clap_complete/src/engine/complete.rs @@ -117,10 +117,7 @@ pub fn complete( } } - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "no completion generated", - )) + Err(std::io::Error::other("no completion generated")) } #[derive(Debug, PartialEq, Eq, Clone)] diff --git a/clap_complete/src/env/mod.rs b/clap_complete/src/env/mod.rs index 5995dd48d..3984b7208 100644 --- a/clap_complete/src/env/mod.rs +++ b/clap_complete/src/env/mod.rs @@ -274,10 +274,7 @@ impl<'s, F: Fn() -> clap::Command> CompleteEnv<'s, F> { let _ = write!(&mut seed, "{prefix}`{name}`"); seed }); - std::io::Error::new( - std::io::ErrorKind::Other, - format!("unknown shell `{name}`, expected one of {shells}"), - ) + std::io::Error::other(format!("unknown shell `{name}`, expected one of {shells}")) })?; Ok(shell) } diff --git a/clap_complete/src/env/shells.rs b/clap_complete/src/env/shells.rs index 4d5c045d9..a46d5d439 100644 --- a/clap_complete/src/env/shells.rs +++ b/clap_complete/src/env/shells.rs @@ -101,10 +101,11 @@ fi } /// Type of completion attempted that caused a completion function to be called -#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Default, Copy, Clone, Debug, PartialEq, Eq)] #[non_exhaustive] enum CompType { /// Normal completion + #[default] Normal, /// List completions after successive tabs Successive, @@ -131,12 +132,6 @@ impl FromStr for CompType { } } -impl Default for CompType { - fn default() -> Self { - Self::Normal - } -} - /// Elvish completion adapter #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct Elvish; @@ -488,7 +483,7 @@ mod tests { &mut buf, ) .expect("write_registration failed"); - return String::from_utf8(buf).expect("Invalid UTF-8"); + String::from_utf8(buf).expect("Invalid UTF-8") }; let script = get_fish_registration("completer"); diff --git a/tests/derive_ui.rs b/tests/derive_ui.rs index 058718cd8..043cb2338 100644 --- a/tests/derive_ui.rs +++ b/tests/derive_ui.rs @@ -8,7 +8,7 @@ #![cfg(feature = "unstable-derive-ui-tests")] #[cfg(feature = "derive")] -#[rustversion::attr(not(stable(1.92)), ignore)] // STABLE +#[rustversion::attr(not(stable(1.93)), ignore)] // STABLE #[test] fn ui() { let t = trybuild::TestCases::new(); diff --git a/tests/derive_ui/bool_value_enum.stderr b/tests/derive_ui/bool_value_enum.stderr index 900c82e66..d8cba0024 100644 --- a/tests/derive_ui/bool_value_enum.stderr +++ b/tests/derive_ui/bool_value_enum.stderr @@ -1,7 +1,11 @@ error[E0277]: the trait bound `bool: ValueEnum` is not satisfied --> tests/derive_ui/bool_value_enum.rs:6:30 | -6 | #[arg(short, value_enum, default_value_t)] - | ^^^^^^^^^^^^^^^ the trait `ValueEnum` is not implemented for `bool` - | - = help: the trait `ValueEnum` is implemented for `ColorChoice` + 6 | #[arg(short, value_enum, default_value_t)] + | ^^^^^^^^^^^^^^^ the trait `ValueEnum` is not implemented for `bool` + | +help: the trait `ValueEnum` is implemented for `ColorChoice` + --> clap_builder/src/util/color.rs + | + | impl ValueEnum for ColorChoice { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/derive_ui/enum_variant_not_args.stderr b/tests/derive_ui/enum_variant_not_args.stderr index 2b9ea252c..2fce50fc6 100644 --- a/tests/derive_ui/enum_variant_not_args.stderr +++ b/tests/derive_ui/enum_variant_not_args.stderr @@ -1,14 +1,19 @@ error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied --> tests/derive_ui/enum_variant_not_args.rs:3:9 | -3 | Sub(SubCmd), - | ^^^^^^ unsatisfied trait bound - | + 3 | Sub(SubCmd), + | ^^^^^^ unsatisfied trait bound + | help: the trait `clap::Args` is not implemented for `SubCmd` - --> tests/derive_ui/enum_variant_not_args.rs:7:1 - | -7 | enum SubCmd {} - | ^^^^^^^^^^^ - = help: the following other types implement trait `clap::Args`: - () - Box + --> tests/derive_ui/enum_variant_not_args.rs:7:1 + | + 7 | enum SubCmd {} + | ^^^^^^^^^^^ +help: the following other types implement trait `clap::Args` + --> clap_builder/src/derive.rs + | + | impl Args for Box { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Box` +... + | impl Args for () { + | ^^^^^^^^^^^^^^^^ `()` diff --git a/tests/derive_ui/flatten_enum_in_struct.stderr b/tests/derive_ui/flatten_enum_in_struct.stderr index e21deedcd..08ea2da61 100644 --- a/tests/derive_ui/flatten_enum_in_struct.stderr +++ b/tests/derive_ui/flatten_enum_in_struct.stderr @@ -1,15 +1,25 @@ error[E0277]: the trait bound `SubCmd: clap::Args` is not satisfied --> tests/derive_ui/flatten_enum_in_struct.rs:4:10 | -4 | sub: SubCmd, - | ^^^^^^ unsatisfied trait bound - | + 4 | sub: SubCmd, + | ^^^^^^ unsatisfied trait bound + | help: the trait `clap::Args` is not implemented for `SubCmd` - --> tests/derive_ui/flatten_enum_in_struct.rs:8:1 - | -8 | enum SubCmd {} - | ^^^^^^^^^^^ - = help: the following other types implement trait `clap::Args`: - () - Box - Opt + --> tests/derive_ui/flatten_enum_in_struct.rs:8:1 + | + 8 | enum SubCmd {} + | ^^^^^^^^^^^ +help: the following other types implement trait `clap::Args` + --> tests/derive_ui/flatten_enum_in_struct.rs:1:10 + | + 1 | #[derive(clap::Parser)] + | ^^^^^^^^^^^^ `Opt` + | + ::: clap_builder/src/derive.rs + | + | impl Args for Box { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Box` +... + | impl Args for () { + | ^^^^^^^^^^^^^^^^ `()` + = note: this error originates in the derive macro `clap::Parser` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/derive_ui/flatten_struct_in_enum.stderr b/tests/derive_ui/flatten_struct_in_enum.stderr index 5ff7d3bb0..d4b91e6ed 100644 --- a/tests/derive_ui/flatten_struct_in_enum.stderr +++ b/tests/derive_ui/flatten_struct_in_enum.stderr @@ -1,16 +1,28 @@ error[E0277]: the trait bound `SubCmd: Subcommand` is not satisfied --> tests/derive_ui/flatten_struct_in_enum.rs:4:9 | -4 | Sub(SubCmd), - | ^^^^^^ unsatisfied trait bound - | + 4 | Sub(SubCmd), + | ^^^^^^ unsatisfied trait bound + | help: the trait `Subcommand` is not implemented for `SubCmd` - --> tests/derive_ui/flatten_struct_in_enum.rs:8:1 - | -8 | struct SubCmd {} - | ^^^^^^^^^^^^^ - = help: the following other types implement trait `Subcommand`: - () - Box - Infallible - Opt + --> tests/derive_ui/flatten_struct_in_enum.rs:8:1 + | + 8 | struct SubCmd {} + | ^^^^^^^^^^^^^ +help: the following other types implement trait `Subcommand` + --> tests/derive_ui/flatten_struct_in_enum.rs:1:10 + | + 1 | #[derive(clap::Parser)] + | ^^^^^^^^^^^^ `Opt` + | + ::: clap_builder/src/derive.rs + | + | impl Subcommand for Box { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Box` +... + | impl Subcommand for () { + | ^^^^^^^^^^^^^^^^^^^^^^ `()` +... + | impl Subcommand for Infallible { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Infallible` + = note: this error originates in the derive macro `clap::Parser` (in Nightly builds, run with -Z macro-backtrace for more info)