summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/misnamed_getters.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /src/tools/clippy/tests/ui/misnamed_getters.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/misnamed_getters.rs')
-rw-r--r--src/tools/clippy/tests/ui/misnamed_getters.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/misnamed_getters.rs b/src/tools/clippy/tests/ui/misnamed_getters.rs
index 03e7dac7d..56ddc46c4 100644
--- a/src/tools/clippy/tests/ui/misnamed_getters.rs
+++ b/src/tools/clippy/tests/ui/misnamed_getters.rs
@@ -9,25 +9,32 @@ struct A {
impl A {
fn a(&self) -> &u8 {
+ //~^ ERROR: getter function appears to return the wrong field
+ //~| NOTE: `-D clippy::misnamed-getters` implied by `-D warnings`
&self.b
}
fn a_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.b
}
fn b(self) -> u8 {
+ //~^ ERROR: getter function appears to return the wrong field
self.a
}
fn b_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.a
}
fn c(&self) -> &u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&self.b
}
fn c_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.a
}
}
@@ -39,17 +46,21 @@ union B {
impl B {
unsafe fn a(&self) -> &u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&self.b
}
unsafe fn a_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.b
}
unsafe fn b(self) -> u8 {
+ //~^ ERROR: getter function appears to return the wrong field
self.a
}
unsafe fn b_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.a
}
@@ -62,17 +73,21 @@ impl B {
}
unsafe fn a_unchecked(&self) -> &u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&self.b
}
unsafe fn a_unchecked_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.b
}
unsafe fn b_unchecked(self) -> u8 {
+ //~^ ERROR: getter function appears to return the wrong field
self.a
}
unsafe fn b_unchecked_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.a
}
@@ -105,16 +120,20 @@ impl core::ops::DerefMut for D {
impl D {
fn a(&self) -> &u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&self.b
}
fn a_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.b
}
fn d(&self) -> &u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&self.b
}
fn d_mut(&mut self) -> &mut u8 {
+ //~^ ERROR: getter function appears to return the wrong field
&mut self.b
}
}