Skip to content

Commit 05cb0df

Browse files
committed
Auto merge of rust-lang#5033 - JohnTitor:split-use-self, r=flip1995
Split up `use_self` ui test Part of rust-lang#2038 changelog: none
2 parents 920cdb5 + 291f2cb commit 05cb0df

File tree

6 files changed

+342
-332
lines changed

6 files changed

+342
-332
lines changed

Diff for: tests/ui/use_self.fixed

-111
Original file line numberDiff line numberDiff line change
@@ -69,117 +69,6 @@ mod lifetimes {
6969
}
7070
}
7171

72-
#[allow(clippy::boxed_local)]
73-
mod traits {
74-
75-
use std::ops::Mul;
76-
77-
trait SelfTrait {
78-
fn refs(p1: &Self) -> &Self;
79-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
80-
fn mut_refs(p1: &mut Self) -> &mut Self;
81-
fn nested(p1: Box<Self>, p2: (&u8, &Self));
82-
fn vals(r: Self) -> Self;
83-
}
84-
85-
#[derive(Default)]
86-
struct Bad;
87-
88-
impl SelfTrait for Bad {
89-
fn refs(p1: &Self) -> &Self {
90-
p1
91-
}
92-
93-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
94-
p1
95-
}
96-
97-
fn mut_refs(p1: &mut Self) -> &mut Self {
98-
p1
99-
}
100-
101-
fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
102-
103-
fn vals(_: Self) -> Self {
104-
Self::default()
105-
}
106-
}
107-
108-
impl Mul for Bad {
109-
type Output = Self;
110-
111-
fn mul(self, rhs: Self) -> Self {
112-
rhs
113-
}
114-
}
115-
116-
impl Clone for Bad {
117-
fn clone(&self) -> Self {
118-
Self
119-
}
120-
}
121-
122-
#[derive(Default)]
123-
struct Good;
124-
125-
impl SelfTrait for Good {
126-
fn refs(p1: &Self) -> &Self {
127-
p1
128-
}
129-
130-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
131-
p1
132-
}
133-
134-
fn mut_refs(p1: &mut Self) -> &mut Self {
135-
p1
136-
}
137-
138-
fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
139-
140-
fn vals(_: Self) -> Self {
141-
Self::default()
142-
}
143-
}
144-
145-
impl Mul for Good {
146-
type Output = Self;
147-
148-
fn mul(self, rhs: Self) -> Self {
149-
rhs
150-
}
151-
}
152-
153-
trait NameTrait {
154-
fn refs(p1: &u8) -> &u8;
155-
fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
156-
fn mut_refs(p1: &mut u8) -> &mut u8;
157-
fn nested(p1: Box<u8>, p2: (&u8, &u8));
158-
fn vals(p1: u8) -> u8;
159-
}
160-
161-
// Using `Self` instead of the type name is OK
162-
impl NameTrait for u8 {
163-
fn refs(p1: &Self) -> &Self {
164-
p1
165-
}
166-
167-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
168-
p1
169-
}
170-
171-
fn mut_refs(p1: &mut Self) -> &mut Self {
172-
p1
173-
}
174-
175-
fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}
176-
177-
fn vals(_: Self) -> Self {
178-
Self::default()
179-
}
180-
}
181-
}
182-
18372
mod issue2894 {
18473
trait IntoBytes {
18574
fn into_bytes(&self) -> Vec<u8>;

Diff for: tests/ui/use_self.rs

-111
Original file line numberDiff line numberDiff line change
@@ -69,117 +69,6 @@ mod lifetimes {
6969
}
7070
}
7171

72-
#[allow(clippy::boxed_local)]
73-
mod traits {
74-
75-
use std::ops::Mul;
76-
77-
trait SelfTrait {
78-
fn refs(p1: &Self) -> &Self;
79-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
80-
fn mut_refs(p1: &mut Self) -> &mut Self;
81-
fn nested(p1: Box<Self>, p2: (&u8, &Self));
82-
fn vals(r: Self) -> Self;
83-
}
84-
85-
#[derive(Default)]
86-
struct Bad;
87-
88-
impl SelfTrait for Bad {
89-
fn refs(p1: &Bad) -> &Bad {
90-
p1
91-
}
92-
93-
fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
94-
p1
95-
}
96-
97-
fn mut_refs(p1: &mut Bad) -> &mut Bad {
98-
p1
99-
}
100-
101-
fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
102-
103-
fn vals(_: Bad) -> Bad {
104-
Bad::default()
105-
}
106-
}
107-
108-
impl Mul for Bad {
109-
type Output = Bad;
110-
111-
fn mul(self, rhs: Bad) -> Bad {
112-
rhs
113-
}
114-
}
115-
116-
impl Clone for Bad {
117-
fn clone(&self) -> Self {
118-
Bad
119-
}
120-
}
121-
122-
#[derive(Default)]
123-
struct Good;
124-
125-
impl SelfTrait for Good {
126-
fn refs(p1: &Self) -> &Self {
127-
p1
128-
}
129-
130-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
131-
p1
132-
}
133-
134-
fn mut_refs(p1: &mut Self) -> &mut Self {
135-
p1
136-
}
137-
138-
fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
139-
140-
fn vals(_: Self) -> Self {
141-
Self::default()
142-
}
143-
}
144-
145-
impl Mul for Good {
146-
type Output = Self;
147-
148-
fn mul(self, rhs: Self) -> Self {
149-
rhs
150-
}
151-
}
152-
153-
trait NameTrait {
154-
fn refs(p1: &u8) -> &u8;
155-
fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
156-
fn mut_refs(p1: &mut u8) -> &mut u8;
157-
fn nested(p1: Box<u8>, p2: (&u8, &u8));
158-
fn vals(p1: u8) -> u8;
159-
}
160-
161-
// Using `Self` instead of the type name is OK
162-
impl NameTrait for u8 {
163-
fn refs(p1: &Self) -> &Self {
164-
p1
165-
}
166-
167-
fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
168-
p1
169-
}
170-
171-
fn mut_refs(p1: &mut Self) -> &mut Self {
172-
p1
173-
}
174-
175-
fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}
176-
177-
fn vals(_: Self) -> Self {
178-
Self::default()
179-
}
180-
}
181-
}
182-
18372
mod issue2894 {
18473
trait IntoBytes {
18574
fn into_bytes(&self) -> Vec<u8>;

0 commit comments

Comments
 (0)