]> git.lizzy.rs Git - rust.git/commit
Implemented suspicious_to_owned lint to check if `to_owned` is called on a `Cow`.
authorMarco Mastropaolo <marco@mastropaolo.com>
Fri, 10 Jun 2022 16:28:31 +0000 (18:28 +0200)
committerMarco Mastropaolo <marcomp@amazon.com>
Sat, 27 Aug 2022 00:41:17 +0000 (17:41 -0700)
commitde028e2fb9d81d58d62dfc7bc8fd2335a9885641
treecef77a398d8c012606fcb79ea588d301bd0e0b4f
parent602bec26b0b60b39196108f518c805af14111e2b
Implemented suspicious_to_owned lint to check if `to_owned` is called on a `Cow`.

This is done because `to_owned` is very similarly named to `into_owned`, but the
effect of calling those two methods is completely different. This creates
confusion (stemming from the ambiguity of the 'owned' term in the context of
`Cow`s) and might not be what the writer intended.
CHANGELOG.md
clippy_lints/src/lib.register_all.rs
clippy_lints/src/lib.register_lints.rs
clippy_lints/src/lib.register_suspicious.rs
clippy_lints/src/methods/mod.rs
clippy_lints/src/methods/suspicious_to_owned.rs [new file with mode: 0644]
tests/compile-test.rs
tests/ui/suspicious_to_owned.rs [new file with mode: 0644]
tests/ui/suspicious_to_owned.stderr [new file with mode: 0644]