mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:24:57 +00:00
Switch to Rust 2024 edition (#18129)
This commit is contained in:
parent
e67b35743a
commit
9ae698fe30
1082 changed files with 4211 additions and 3300 deletions
|
@ -92,7 +92,7 @@ pub(crate) fn derive_cache_key(item: &DeriveInput) -> syn::Result<TokenStream> {
|
|||
return Err(Error::new(
|
||||
item.span(),
|
||||
"CacheKey does not support unions. Only structs and enums are supported",
|
||||
))
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -143,7 +143,7 @@ impl Parse for CacheKeyFieldAttributes {
|
|||
return Err(Error::new(
|
||||
arg.span(),
|
||||
format!("Unknown `cache_field` argument {name}"),
|
||||
))
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,15 +271,24 @@ fn parse_field_attributes(attribute: &Attribute) -> syn::Result<FieldAttributes>
|
|||
})?;
|
||||
|
||||
let Some(default) = default else {
|
||||
return Err(syn::Error::new(attribute.span(), "Mandatory `default` field is missing in `#[option]` attribute. Specify the default using `#[option(default=\"..\")]`."));
|
||||
return Err(syn::Error::new(
|
||||
attribute.span(),
|
||||
"Mandatory `default` field is missing in `#[option]` attribute. Specify the default using `#[option(default=\"..\")]`.",
|
||||
));
|
||||
};
|
||||
|
||||
let Some(value_type) = value_type else {
|
||||
return Err(syn::Error::new(attribute.span(), "Mandatory `value_type` field is missing in `#[option]` attribute. Specify the value type using `#[option(value_type=\"..\")]`."));
|
||||
return Err(syn::Error::new(
|
||||
attribute.span(),
|
||||
"Mandatory `value_type` field is missing in `#[option]` attribute. Specify the value type using `#[option(value_type=\"..\")]`.",
|
||||
));
|
||||
};
|
||||
|
||||
let Some(example) = example else {
|
||||
return Err(syn::Error::new(attribute.span(), "Mandatory `example` field is missing in `#[option]` attribute. Add an example using `#[option(example=\"..\")]`."));
|
||||
return Err(syn::Error::new(
|
||||
attribute.span(),
|
||||
"Mandatory `example` field is missing in `#[option]` attribute. Add an example using `#[option(example=\"..\")]`.",
|
||||
));
|
||||
};
|
||||
|
||||
Ok(FieldAttributes {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, quote_spanned, ToTokens};
|
||||
use quote::{ToTokens, quote, quote_spanned};
|
||||
use syn::spanned::Spanned;
|
||||
use syn::token::{Dot, Paren};
|
||||
use syn::{Block, Expr, ExprLit, ExprMethodCall, ItemFn, Lit, Stmt};
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::cache_key::derive_cache_key;
|
|||
use crate::newtype_index::generate_newtype_index;
|
||||
use crate::violation_metadata::violation_metadata;
|
||||
use proc_macro::TokenStream;
|
||||
use syn::{parse_macro_input, DeriveInput, Error, ItemFn, ItemStruct};
|
||||
use syn::{DeriveInput, Error, ItemFn, ItemStruct, parse_macro_input};
|
||||
|
||||
mod cache_key;
|
||||
mod combine;
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::collections::{BTreeMap, HashMap};
|
|||
|
||||
use itertools::Itertools;
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, ToTokens};
|
||||
use quote::{ToTokens, quote};
|
||||
use syn::{
|
||||
parenthesized, parse::Parse, spanned::Spanned, Attribute, Error, Expr, ExprCall, ExprMatch,
|
||||
Ident, ItemFn, LitStr, Pat, Path, Stmt, Token,
|
||||
Attribute, Error, Expr, ExprCall, ExprMatch, Ident, ItemFn, LitStr, Pat, Path, Stmt, Token,
|
||||
parenthesized, parse::Parse, spanned::Spanned,
|
||||
};
|
||||
|
||||
use crate::rule_code_prefix::{get_prefix_ident, intersection_all};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue