Skip to content

Commit

Permalink
Turn off syn/clone-impls feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 7, 2024
1 parent 94a3165 commit 315fd90
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ proc-macro = true
[dependencies]
proc-macro2 = "1.0.74"
quote = "1.0.35"
syn = { version = "2.0.46", default-features = false, features = ["full", "visit-mut", "parsing", "printing", "proc-macro", "clone-impls"] }
syn = { version = "2.0.46", default-features = false, features = ["full", "visit-mut", "parsing", "printing", "proc-macro"] }

[dev-dependencies]
futures = "0.3.30"
Expand Down
4 changes: 2 additions & 2 deletions src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ fn transform_sig(
sig.fn_token.span = sig.asyncness.take().unwrap().span;

let (ret_arrow, ret) = match &sig.output {
ReturnType::Default => (Token![->](Span::call_site()), quote!(())),
ReturnType::Type(arrow, ret) => (*arrow, quote!(#ret)),
ReturnType::Default => (quote!(->), quote!(())),
ReturnType::Type(arrow, ret) => (quote!(#arrow), quote!(#ret)),
};

let mut lifetimes = CollectLifetimes::new();
Expand Down
6 changes: 3 additions & 3 deletions src/lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl CollectLifetimes {
}
}

fn visit_opt_lifetime(&mut self, reference: Token![&], lifetime: &mut Option<Lifetime>) {
fn visit_opt_lifetime(&mut self, reference: &Token![&], lifetime: &mut Option<Lifetime>) {
match lifetime {
None => *lifetime = Some(self.next_lifetime(reference.span)),
Some(lifetime) => self.visit_lifetime(lifetime),
Expand All @@ -45,14 +45,14 @@ impl CollectLifetimes {
impl VisitMut for CollectLifetimes {
fn visit_receiver_mut(&mut self, arg: &mut Receiver) {
if let Some((reference, lifetime)) = &mut arg.reference {
self.visit_opt_lifetime(*reference, lifetime);
self.visit_opt_lifetime(reference, lifetime);
} else {
visit_mut::visit_type_mut(self, &mut arg.ty);
}
}

fn visit_type_reference_mut(&mut self, ty: &mut TypeReference) {
self.visit_opt_lifetime(ty.and_token, &mut ty.lifetime);
self.visit_opt_lifetime(&ty.and_token, &mut ty.lifetime);
visit_mut::visit_type_reference_mut(self, ty);
}

Expand Down
4 changes: 2 additions & 2 deletions src/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ struct HasMutPat(Option<Token![mut]>);

impl VisitMut for HasMutPat {
fn visit_pat_ident_mut(&mut self, i: &mut PatIdent) {
if let Some(m) = i.mutability {
self.0 = Some(m);
if let Some(m) = &i.mutability {
self.0 = Some(Token![mut](m.span));
} else {
visit_mut::visit_pat_ident_mut(self, i);
}
Expand Down

0 comments on commit 315fd90

Please sign in to comment.