Skip to content

Commit cc2fcfa

Browse files
committed
Revert "Resolve clippy pedantic lints"
This reverts commit 34f3aeb.
1 parent 34f3aeb commit cc2fcfa

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@
307307
clippy::default_trait_access,
308308
clippy::doc_markdown,
309309
clippy::if_not_else,
310-
clippy::items_after_statements,
311310
clippy::match_like_matches_macro,
312311
clippy::module_name_repetitions,
313312
clippy::shadow_unrelated,

src/receiver.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ impl VisitMut for HasSelf {
8888
pub struct ReplaceSelf(pub Span);
8989

9090
impl ReplaceSelf {
91+
fn prepend_underscore_to_self(&self, ident: &mut Ident) -> bool {
92+
let modified = ident == "self";
93+
if modified {
94+
*ident = Ident::new("__self", ident.span());
95+
#[cfg(self_span_hack)]
96+
ident.set_span(self.0);
97+
}
98+
modified
99+
}
100+
91101
fn visit_token_stream(&mut self, tokens: &mut TokenStream) -> bool {
92102
let mut out = Vec::new();
93103
let mut modified = false;
@@ -106,7 +116,7 @@ impl ReplaceSelf {
106116
for tt in tokens {
107117
match tt {
108118
TokenTree::Ident(mut ident) => {
109-
*modified |= prepend_underscore_to_self(&mut ident);
119+
*modified |= visitor.prepend_underscore_to_self(&mut ident);
110120
out.push(TokenTree::Ident(ident));
111121
}
112122
TokenTree::Group(group) => {
@@ -125,7 +135,7 @@ impl ReplaceSelf {
125135

126136
impl VisitMut for ReplaceSelf {
127137
fn visit_ident_mut(&mut self, i: &mut Ident) {
128-
prepend_underscore_to_self(i);
138+
self.prepend_underscore_to_self(i);
129139
}
130140

131141
fn visit_item_mut(&mut self, i: &mut Item) {
@@ -149,13 +159,3 @@ impl VisitMut for ReplaceSelf {
149159
}
150160
}
151161
}
152-
153-
fn prepend_underscore_to_self(ident: &mut Ident) -> bool {
154-
let modified = ident == "self";
155-
if modified {
156-
*ident = Ident::new("__self", ident.span());
157-
#[cfg(self_span_hack)]
158-
ident.set_span(self.0);
159-
}
160-
modified
161-
}

0 commit comments

Comments
 (0)