Skip to content

Commit

Permalink
Merge pull request #273 from dtolnay/cloneimpls
Browse files Browse the repository at this point in the history
Turn off syn/clone-impls feature
  • Loading branch information
dtolnay authored Jul 7, 2024
2 parents 94a3165 + b6c6063 commit 4ec740e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 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
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@
clippy::module_name_repetitions,
clippy::shadow_unrelated,
clippy::similar_names,
clippy::too_many_lines
clippy::too_many_lines,
clippy::trivially_copy_pass_by_ref
)]

extern crate proc_macro;
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 4ec740e

Please sign in to comment.