Skip to content

FP: clippy::str-to-string suggestion for non-&str type #16569

@edwloef

Description

@edwloef

Summary

This line of code, puzzlingly, emits this warning with nightly clippy, even though no &str is involved: https://github.com/generic-daw/generic-daw/blob/15f717b377b36adf61740362697cd616d64e70af/generic_daw_gui/src/daw.rs#L465

Lint Name

clippy::str-to-string

Reproducer

I tried this code: https://github.com/generic-daw/generic-daw/blob/15f717b377b36adf61740362697cd616d64e70af/generic_daw_gui/src/daw.rs#L465

I saw this happen:

warning: `ToString::to_string` used as `&str` to `String` converter
   --> generic_daw_gui/src/daw.rs:465:54
    |
465 |                     pick_list(None::<FileMenu>, FileMenu::VARIANTS, FileMenu::to_string)
    |                                                                     ^^^^^^^^^^^^^^^^^^^ help: try: `ToOwned::to_owned`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
    = note: requested on the command line with `-W clippy::str-to-string`

I expected to see this happen:

no warning

Version

rustc 1.95.0-nightly (a423f68a0 2026-02-13)
binary: rustc
commit-hash: a423f68a0d75656eabab4982a06bed9f316f7109
commit-date: 2026-02-13
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0

Additional Labels

@rustbot label +I-suggestion-causes-error

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveI-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