Skip to content

redundant_closure_for_method_calls suggests the wrong path for types across inline modules #10854

@alexkazik

Description

@alexkazik

I tried this code:

cargo clippy --fix

Instead, this happened:

warning: failed to automatically apply fixes suggested by rustc to crate `project`

after fixes were automatically applied the compiler reported errors within these files:

  * src/pane/list.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error[E0433]: failed to resolve: use of undeclared crate or module `data`
   --> src/pane/list.rs:119:39
    |
119 |             let e = e.into_iter().map(data::game_data::EncounterType::icon);
    |                                       ^^^^ use of undeclared crate or module `data`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.
Original diagnostics will follow.

The mentioned line is different as quoted above, it's:

            let e = e.into_iter().map(|e|e.icon());

Either crate::data::game_data::EncounterType::icon or EncounterType::icon does work without any changes.

Meta

rustc --version --verbose:

rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: aarch64-apple-darwin
release: 1.69.0
LLVM version: 15.0.7

Nightly

on nightly the error is slightly different

warning: failed to automatically apply fixes suggested by rustc to crate `project`

after fixes were automatically applied the compiler reported errors within these files:

  * src/pane/list.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error[E0433]: failed to resolve: use of undeclared crate or module `data`
   --> src/pane/list.rs:119:39
    |
119 |             let e = e.into_iter().map(data::game_data::EncounterType::icon);
    |                                       ^^^^ use of undeclared crate or module `data`
    |
help: consider importing this enum
    |
1   + use crate::pane::list::EncounterType;
    |
help: if you import `EncounterType`, refer to it directly
    |
119 -             let e = e.into_iter().map(data::game_data::EncounterType::icon);
119 +             let e = e.into_iter().map(EncounterType::icon);
    |

error: aborting due to previous error

nightly version:

rustc 1.72.0-nightly (498553fc0 2023-05-29)
binary: rustc
commit-hash: 498553fc04f6a3fdc53412320f4e913bc53bc267
commit-date: 2023-05-29
host: aarch64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions