Skip to content

Nightly regression: clippy --fix does no edits but suggests running the same clippy --fix command #15031

Open
@ilyagr

Description

@ilyagr

Summary

If I run any of these commands:

  • cargo clippy --fix --workspace --all-targets --all-features
  • cargo clippy --fix --example "custom-backend"
  • cargo clippy --fix --lib -p jj-lib

on https://github.com/jj-vcs/jj/tree/b09c243ba37a5ed9f05320de17b80ec74c69b02d, Clippy does not change anything in the repo, but suggests that I run clippy --fix again. E.g, it suggests:

  • "run cargo clippy --fix --example "custom-backend" to apply 1 suggestion" (which is the command I just ran).
  • "run cargo clippy --fix --lib -p jj-lib to apply 17 suggestions"

This seems to be connected with the mismatched_lifetime_syntaxes lint. A longer excerpt hidden inside <details> below. Again, in spite of it saying "Fixed", nothing is changed in the repo.

       Fixed lib/testutils/src/test_backend.rs (0 fixes)
warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/testutils/src/test_backend.rs:392:9
    |
392 |         &self,
    |         ^^^^^ this lifetime flows to the output
...
396 |     ) -> BackendResult<BoxStream<BackendResult<CopyRecord>>> {
    |                        ------------------------------------ the lifetime gets resolved as `'_`
    |
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
396 |     ) -> BackendResult<BoxStream<'_, BackendResult<CopyRecord>>> {
    |                                  +++

warning: `testutils` (lib test) generated 1 warning (run `cargo clippy --fix --lib -p testutils --tests` to apply 1 suggestion)
       Fixed cli/src/config.rs (0 fixes)
       Fixed cli/src/cli_util.rs (0 fixes)
       Fixed cli/src/template_parser.rs (0 fixes)
warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/cli_util.rs:827:40
    |
827 |     pub(crate) fn revset_parse_context(&self) -> RevsetParseContext {
    |                                        ^^^^^     ------------------ the lifetime gets resolved as `'_`
    |                                        |
    |                                        this lifetime flows to the output
    |
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
827 |     pub(crate) fn revset_parse_context(&self) -> RevsetParseContext<'_> {
    |                                                                    ++++

warning: lifetime flowing from input to output with different syntax can be confusing
    --> cli/src/cli_util.rs:1244:9
     |
1244 |         &mut self,
     |         ^^^^^^^^^ this lifetime flows to the output
1245 |     ) -> Result<(LockedWorkspace, Commit), CommandError> {
     |                  --------------- the lifetime gets resolved as `'_`
     |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
     |
1245 |     ) -> Result<(LockedWorkspace<'_>, Commit), CommandError> {
     |                                 ++++

warning: lifetime flowing from input to output with different syntax can be confusing
    --> cli/src/cli_util.rs:1259:9
     |
1259 |         &mut self,
     |         ^^^^^^^^^ this lifetime flows to the output
1260 |     ) -> Result<(LockedWorkspace, Commit), CommandError> {
     |                  --------------- the lifetime gets resolved as `'_`
     |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
     |
1260 |     ) -> Result<(LockedWorkspace<'_>, Commit), CommandError> {
     |                                 ++++

warning: lifetime flowing from input to output with different syntax can be confusing
    --> cli/src/cli_util.rs:2047:30
     |
2047 |     pub fn start_transaction(&mut self) -> WorkspaceCommandTransaction {
     |                              ^^^^^^^^^     --------------------------- the lifetime gets resolved as `'_`
     |                              |
     |                              this lifetime flows to the output
     |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
     |
2047 |     pub fn start_transaction(&mut self) -> WorkspaceCommandTransaction<'_> {
     |                                                                       ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/config.rs:761:23
    |
761 |     pub fn split_name(&self) -> Cow<str> {
    |                       ^^^^^     -------- the lifetime gets resolved as `'_`
    |                       |
    |                       this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
761 |     pub fn split_name(&self) -> Cow<'_, str> {
    |                                     +++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/config.rs:769:32
    |
769 |     pub fn split_name_and_args(&self) -> (Cow<str>, Cow<[String]>) {
    |                                ^^^^^      --------  ------------- the lifetimes get resolved as `'_`
    |                                |          |
    |                                |          the lifetimes get resolved as `'_`
    |                                this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
769 |     pub fn split_name_and_args(&self) -> (Cow<'_, str>, Cow<'_, [String]>) {
    |                                               +++           +++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/template_parser.rs:422:32
    |
422 | fn parse_identifier_name(pair: Pair<Rule>) -> TemplateParseResult<&str> {
    |                                ^^^^^^^^^^                         ---- the lifetime gets resolved as `'_`
    |                                |
    |                                this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
422 | fn parse_identifier_name(pair: Pair<'_, Rule>) -> TemplateParseResult<&str> {
    |                                     +++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/template_parser.rs:431:41
    |
431 | fn parse_formal_parameters(params_pair: Pair<Rule>) -> TemplateParseResult<Vec<&str>> {
    |                                         ^^^^^^^^^^                             ---- the lifetime gets resolved as `'_`
    |                                         |
    |                                         this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
431 | fn parse_formal_parameters(params_pair: Pair<'_, Rule>) -> TemplateParseResult<Vec<&str>> {
    |                                              +++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/template_parser.rs:594:38
    |
594 | pub fn parse_template(template_text: &str) -> TemplateParseResult<ExpressionNode> {
    |                                      ^^^^                         -------------- the lifetime gets resolved as `'_`
    |                                      |
    |                                      this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
594 | pub fn parse_template(template_text: &str) -> TemplateParseResult<ExpressionNode<'_>> {
    |                                                                                 ++++

warning: `jj-cli` (lib) generated 9 warnings (run `cargo clippy --fix --lib -p jj-cli` to apply 9 suggestions)
       Fixed lib/testutils/src/test_backend.rs (0 fixes)
warning: `testutils` (lib) generated 1 warning (1 duplicate)
       Fixed cli/examples/custom-backend/main.rs (0 fixes)
warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/examples/custom-backend/main.rs:217:9
    |
217 |         &self,
    |         ^^^^^ this lifetime flows to the output
...
221 |     ) -> BackendResult<BoxStream<BackendResult<CopyRecord>>> {
    |                        ------------------------------------ the lifetime gets resolved as `'_`
    |
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
221 |     ) -> BackendResult<BoxStream<'_, BackendResult<CopyRecord>>> {
    |                                  +++

warning: `jj-cli` (example "custom-backend") generated 1 warning (run `cargo clippy --fix --example "custom-backend"` to apply 1 suggestion)
       Fixed lib/src/default_index/readonly.rs (0 fixes)
       Fixed lib/src/tree.rs (0 fixes)
       Fixed lib/src/secret_backend.rs (0 fixes)
       Fixed lib/src/backend.rs (0 fixes)
       Fixed lib/src/store.rs (0 fixes)
       Fixed lib/src/git_backend.rs (0 fixes)
       Fixed lib/src/merged_tree.rs (0 fixes)
       Fixed lib/src/fileset_parser.rs (0 fixes)
       Fixed lib/src/config.rs (0 fixes)
       Fixed lib/src/repo.rs (0 fixes)
       Fixed lib/src/workspace.rs (0 fixes)
       Fixed lib/src/revset_parser.rs (0 fixes)
       Fixed lib/src/simple_backend.rs (0 fixes)
warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/src/fileset_parser.rs:356:30
    |
356 |     fn parse_into_kind(text: &str) -> Result<ExpressionKind, FilesetParseErrorKind> {
    |                              ^^^^            -------------- the lifetime gets resolved as `'_`
    |                              |
    |                              this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
356 |     fn parse_into_kind(text: &str) -> Result<ExpressionKind<'_>, FilesetParseErrorKind> {
    |                                                            ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/src/fileset_parser.rs:362:41
    |
362 |     fn parse_maybe_bare_into_kind(text: &str) -> Result<ExpressionKind, FilesetParseErrorKind> {
    |                                         ^^^^            -------------- the lifetime gets resolved as `'_`
    |                                         |
    |                                         this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
362 |     fn parse_maybe_bare_into_kind(text: &str) -> Result<ExpressionKind<'_>, FilesetParseErrorKind> {
    |                                                                       ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/src/fileset_parser.rs:368:31
    |
368 |     fn parse_normalized(text: &str) -> ExpressionNode {
    |                               ^^^^     -------------- the lifetime gets resolved as `'_`
    |                               |
    |                               this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
368 |     fn parse_normalized(text: &str) -> ExpressionNode<'_> {
    |                                                      ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/src/fileset_parser.rs:372:42
    |
372 |     fn parse_maybe_bare_normalized(text: &str) -> ExpressionNode {
    |                                          ^^^^     -------------- the lifetime gets resolved as `'_`
    |                                          |
    |                                          this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
372 |     fn parse_maybe_bare_normalized(text: &str) -> ExpressionNode<'_> {
    |                                                                 ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/src/revset_parser.rs:888:30
    |
888 |     fn parse_into_kind(text: &str) -> Result<ExpressionKind, RevsetParseErrorKind> {
    |                              ^^^^            -------------- the lifetime gets resolved as `'_`
    |                              |
    |                              this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
888 |     fn parse_into_kind(text: &str) -> Result<ExpressionKind<'_>, RevsetParseErrorKind> {
    |                                                            ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> lib/src/revset_parser.rs:894:31
    |
894 |     fn parse_normalized(text: &str) -> ExpressionNode {
    |                               ^^^^     -------------- the lifetime gets resolved as `'_`
    |                               |
    |                               this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
894 |     fn parse_normalized(text: &str) -> ExpressionNode<'_> {
    |                                                      ++++

warning: `jj-lib` (lib test) generated 23 warnings (17 duplicates) (run `cargo clippy --fix --lib -p jj-lib --tests` to apply 6 suggestions)
       Fixed cli/src/config.rs (0 fixes)
       Fixed cli/src/cli_util.rs (0 fixes)
       Fixed cli/src/template_parser.rs (0 fixes)
warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/template_parser.rs:776:39
    |
776 |     fn parse_into_kind(template_text: &str) -> Result<ExpressionKind, TemplateParseErrorKind> {
    |                                       ^^^^            -------------- the lifetime gets resolved as `'_`
    |                                       |
    |                                       this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
776 |     fn parse_into_kind(template_text: &str) -> Result<ExpressionKind<'_>, TemplateParseErrorKind> {
    |                                                                     ++++

warning: lifetime flowing from input to output with different syntax can be confusing
   --> cli/src/template_parser.rs:782:40
    |
782 |     fn parse_normalized(template_text: &str) -> ExpressionNode {
    |                                        ^^^^     -------------- the lifetime gets resolved as `'_`
    |                                        |
    |                                        this lifetime flows to the output
    |
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
    |
782 |     fn parse_normalized(template_text: &str) -> ExpressionNode<'_> {
    |                                                               ++++

warning: `jj-cli` (lib test) generated 11 warnings (9 duplicates) (run `cargo clippy --fix --lib -p jj-cli --tests` to apply 2 suggestions)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 56.59s

Reproducer

See above.

I just updated the nightly from rustc 1.89.0-nightly (4b27a04cc 2025-06-04) to today's nightly (see below).

I double-checked, and this was not a problem with rustc 1.89.0-nightly (59aa1e873 2025-06-03). These warnings are not generated at all with that version from a week ago (some unrelated cloned_refs_to_sliced_ref warnings are).

Version

rustc 1.89.0-nightly (d13a431a6 2025-06-09)
binary: rustc
commit-hash: d13a431a6cc69cd65efe7c3eb7808251d6fd7a46
commit-date: 2025-06-09
host: aarch64-apple-darwin
release: 1.89.0-nightly
LLVM version: 20.1.5

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions