Files
rust/compiler
Jonathan Brouwer 22b4b28a70 Rollup merge of #157872 - qaijuang:fix-suspicious-double-ref-op-type, r=camelid
`suspicious_double_ref_op`: report unadjusted return type

`suspicious_double_ref_op` uses the adjusted expression type to distinguish a no-op call from a double-reference operation. When the result is used as another method's receiver, that type can include the parent method's receiver adjustment.

For example, `file.clone().write(&[])` reports that `clone` returns `&mut &File`, even though it returns `&File`.

This PR continues to use the adjusted type for lint classification, but now uses the method call's unadjusted type in the diagnostic. The same issue affects `.deref()`, so the regression test covers both operations.

Fixes rust-lang/rust#146227
2026-06-15 13:33:24 +02:00
..