Skip to content

Commit 34f3aeb

Browse files
committed
Resolve clippy pedantic lints
1 parent f8fded6 commit 34f3aeb

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@
307307
clippy::default_trait_access,
308308
clippy::doc_markdown,
309309
clippy::if_not_else,
310+
clippy::items_after_statements,
310311
clippy::match_like_matches_macro,
311312
clippy::module_name_repetitions,
312313
clippy::shadow_unrelated,

src/receiver.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ 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-
10191
fn visit_token_stream(&mut self, tokens: &mut TokenStream) -> bool {
10292
let mut out = Vec::new();
10393
let mut modified = false;
@@ -116,7 +106,7 @@ impl ReplaceSelf {
116106
for tt in tokens {
117107
match tt {
118108
TokenTree::Ident(mut ident) => {
119-
*modified |= visitor.prepend_underscore_to_self(&mut ident);
109+
*modified |= prepend_underscore_to_self(&mut ident);
120110
out.push(TokenTree::Ident(ident));
121111
}
122112
TokenTree::Group(group) => {
@@ -135,7 +125,7 @@ impl ReplaceSelf {
135125

136126
impl VisitMut for ReplaceSelf {
137127
fn visit_ident_mut(&mut self, i: &mut Ident) {
138-
self.prepend_underscore_to_self(i);
128+
prepend_underscore_to_self(i);
139129
}
140130

141131
fn visit_item_mut(&mut self, i: &mut Item) {
@@ -159,3 +149,13 @@ impl VisitMut for ReplaceSelf {
159149
}
160150
}
161151
}
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)