Auto merge of #10621 - fee1-dead-contrib:bump_syn, r=flip1995

bump syn to 2.0

changelog: none
This commit is contained in:
bors 2023-04-12 08:27:12 +00:00
commit 0d06001449
5 changed files with 9 additions and 9 deletions

View file

@ -49,7 +49,7 @@ if_chain = "1.0"
itertools = "0.10.1"
quote = "1.0"
serde = { version = "1.0.125", features = ["derive"] }
syn = { version = "1.0", features = ["full"] }
syn = { version = "2.0", features = ["full"] }
futures = "0.3"
parking_lot = "0.12"
tokio = { version = "1", features = ["io-util"] }

View file

@ -10,7 +10,7 @@ proc-macro = true
[dependencies]
itertools = "0.10.1"
quote = "1.0.21"
syn = "1.0.100"
syn = "2.0"
[features]
deny-warnings = []

View file

@ -6,16 +6,16 @@
use proc_macro::TokenStream;
use quote::{format_ident, quote};
use syn::parse::{Parse, ParseStream};
use syn::{parse_macro_input, Attribute, Error, Ident, Lit, LitStr, Meta, Result, Token};
use syn::{parse_macro_input, Attribute, Error, Expr, ExprLit, Ident, Lit, LitStr, Meta, Result, Token};
fn parse_attr<const LEN: usize>(path: [&'static str; LEN], attr: &Attribute) -> Option<LitStr> {
if let Meta::NameValue(name_value) = attr.parse_meta().ok()? {
if let Meta::NameValue(name_value) = &attr.meta {
let path_idents = name_value.path.segments.iter().map(|segment| &segment.ident);
if itertools::equal(path_idents, path)
&& let Lit::Str(lit) = name_value.lit
&& let Expr::Lit(ExprLit { lit: Lit::Str(s), .. }) = &name_value.value
{
return Some(lit);
return Some(s.clone());
}
}

View file

@ -28,7 +28,7 @@ pub fn dummy(_args: TokenStream, input: TokenStream) -> TokenStream {
pub fn fake_async_trait(_args: TokenStream, input: TokenStream) -> TokenStream {
let mut item = parse_macro_input!(input as ItemTrait);
for inner in &mut item.items {
if let TraitItem::Method(method) = inner {
if let TraitItem::Fn(method) = inner {
let sig = &method.sig;
let block = &mut method.default;
if let Some(block) = block {
@ -70,7 +70,7 @@ pub fn rename_my_lifetimes(_args: TokenStream, input: TokenStream) -> TokenStrea
// Look for methods having arbitrary self type taken by &mut ref
for inner in &mut item.items {
if let ImplItem::Method(method) = inner {
if let ImplItem::Fn(method) = inner {
if let Some(FnArg::Typed(pat_type)) = mut_receiver_of(&mut method.sig) {
if let box Type::Reference(reference) = &mut pat_type.ty {
// Target only unnamed lifetimes

View file

@ -2,7 +2,7 @@ error: the type of the `self` parameter does not need to be arbitrary
--> $DIR/needless_arbitrary_self_type_unfixable.rs:42:31
|
LL | fn call_with_mut_self(self: &mut Self) {}
| ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&'_ mut self`
| ^^^^^^^^^^^^^^^ help: consider to change this parameter to: `&mut self`
|
= note: `-D clippy::needless-arbitrary-self-type` implied by `-D warnings`