What it does
Cargo will happily accept the following:
[dependencies]
foo = { package = "foo", version = "1.0" }
Where package declaration is redundant as crate name foo in package and the new alias foo are the same.
The lint would just suggesting removing package = "foo" key.
Similar to how rust fmt will convert use foo as foo; to use foo;
Advantage
I encountered this in the wild here. This crashes renovate (their bug, not Cargo's problem).
Drawbacks
None? I can't imagine a situation where this wasn't a no-op.
Example
[dependencies]
foo = { package = "foo", version = "1.0" }
[dependencies.bar]
version = "1.0"
package = "bar"
Could be written as:
[dependencies]
foo = { version = "1.0" }
foo = "1.0"
[dependencies.bar]
version = "1.0"
What it does
Cargo will happily accept the following:
Where
packagedeclaration is redundant as crate namefooinpackageand the new aliasfooare the same.The lint would just suggesting removing
package = "foo"key.Similar to how rust fmt will convert
use foo as foo;touse foo;Advantage
I encountered this in the wild here. This crashes renovate (their bug, not Cargo's problem).
Drawbacks
None? I can't imagine a situation where this wasn't a no-op.
Example
Could be written as: