about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-31 05:13:48 +0000
committerbors <bors@rust-lang.org>2023-10-31 05:13:48 +0000
commit7d34406015fce08031d0986dec0a4689a3cc407e (patch)
tree995144f4f9e77fe7ba0cae2210a2f378fcd2460d /compiler/rustc_parse/src
parent3da80dc7527c1232c2e7cd0ca8e82f92866a5e4f (diff)
parent69c3b9c2523290f07713efdbfb4dc4a0369416b1 (diff)
downloadrust-7d34406015fce08031d0986dec0a4689a3cc407e.tar.gz
rust-7d34406015fce08031d0986dec0a4689a3cc407e.zip
Auto merge of #11669 - y21:issue11577, r=Jarcho
new lint: `unnecessary_fallible_conversions`

Closes #11577

A new lint that looks for calls such as `i64::try_from(1i32)` and suggests `i64::from(1i32)`. See lint description (and linked issue) for more details for why.

There's a tiny bit of overlap with the `useless_conversion` lint, in that the other one warns `T::try_from(T)` (i.e., fallibly converting to the same type), so this lint ignores cases like `i32::try_from(1i32)` to avoid emitting two warnings for the same expression.

Also, funnily enough, with this one exception, this lint would warn on exactly every case in the `useless_conversion_try` ui test that `useless_conversion` didn't cover (but never two warnings at the same time), which is neat. I did add an `#![allow]` though since we don't want interleaved warnings from multiple lints in the same uitest.

changelog: new lint: `unnecessary_fallible_conversions`
Diffstat (limited to 'compiler/rustc_parse/src')
0 files changed, 0 insertions, 0 deletions