mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Always reborrow reference receiver in methods
This commit is contained in:
parent
ea22d245b6
commit
7ba93cb8cf
3 changed files with 39 additions and 2 deletions
|
@ -315,6 +315,8 @@ fn main() {
|
|||
(&Struct).consume();
|
||||
//^^^^^^^*
|
||||
(&Struct).by_ref();
|
||||
//^^^^^^^&
|
||||
//^^^^^^^*
|
||||
|
||||
(&mut Struct).consume();
|
||||
//^^^^^^^^^^^*
|
||||
|
@ -322,6 +324,8 @@ fn main() {
|
|||
//^^^^^^^^^^^&
|
||||
//^^^^^^^^^^^*
|
||||
(&mut Struct).by_ref_mut();
|
||||
//^^^^^^^^^^^&mut $
|
||||
//^^^^^^^^^^^*
|
||||
|
||||
// Check that block-like expressions don't duplicate hints
|
||||
let _: &mut [u32] = (&mut []);
|
||||
|
@ -414,6 +418,10 @@ fn main() {
|
|||
//^^^^^^^)
|
||||
//^^^^^^^.*
|
||||
(&Struct).by_ref();
|
||||
//^^^^^^^(
|
||||
//^^^^^^^)
|
||||
//^^^^^^^.*
|
||||
//^^^^^^^.&
|
||||
|
||||
(&mut Struct).consume();
|
||||
//^^^^^^^^^^^(
|
||||
|
@ -425,6 +433,10 @@ fn main() {
|
|||
//^^^^^^^^^^^.*
|
||||
//^^^^^^^^^^^.&
|
||||
(&mut Struct).by_ref_mut();
|
||||
//^^^^^^^^^^^(
|
||||
//^^^^^^^^^^^)
|
||||
//^^^^^^^^^^^.*
|
||||
//^^^^^^^^^^^.&mut
|
||||
|
||||
// Check that block-like expressions don't duplicate hints
|
||||
let _: &mut [u32] = (&mut []);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue