mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Auto merge of #10621 - fee1-dead-contrib:bump_syn, r=flip1995
bump syn to 2.0 changelog: none
This commit is contained in:
commit
0d06001449
5 changed files with 9 additions and 9 deletions
|
@ -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"] }
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`
|
||||
|
||||
|
|
Loading…
Reference in a new issue