Skip to content

Commit

Permalink
Drop support for compilers older than 1.47
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 11, 2024
1 parent 83a5422 commit 10b5c99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 39 deletions.
27 changes: 0 additions & 27 deletions build.rs

This file was deleted.

21 changes: 9 additions & 12 deletions src/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,15 @@ impl VisitMut for HasSelf {

pub struct ReplaceSelf;

impl ReplaceSelf {
#[cfg_attr(not(self_span_hack), allow(clippy::unused_self))]
fn prepend_underscore_to_self(&self, ident: &mut Ident) -> bool {
let modified = ident == "self";
if modified {
*ident = Ident::new("__self", ident.span());
#[cfg(self_span_hack)]
ident.set_span(self.0);
}
modified
fn prepend_underscore_to_self(ident: &mut Ident) -> bool {
let modified = ident == "self";
if modified {
*ident = Ident::new("__self", ident.span());
}
modified
}

impl ReplaceSelf {
fn visit_token_stream(&mut self, tokens: &mut TokenStream) -> bool {
let mut out = Vec::new();
let mut modified = false;
Expand All @@ -110,7 +107,7 @@ impl ReplaceSelf {
for tt in tokens {
match tt {
TokenTree::Ident(mut ident) => {
*modified |= visitor.prepend_underscore_to_self(&mut ident);
*modified |= prepend_underscore_to_self(&mut ident);
out.push(TokenTree::Ident(ident));
}
TokenTree::Group(group) => {
Expand All @@ -129,7 +126,7 @@ impl ReplaceSelf {

impl VisitMut for ReplaceSelf {
fn visit_ident_mut(&mut self, i: &mut Ident) {
self.prepend_underscore_to_self(i);
prepend_underscore_to_self(i);
}

fn visit_path_mut(&mut self, p: &mut Path) {
Expand Down

0 comments on commit 10b5c99

Please sign in to comment.