Upgrade to the Rust 2024 edition (#2367)

* Update to rust 2024 edition

* Fixes

* Clean up imports

* Cargo fmt again

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2025-03-13 01:29:12 +01:00
committed by GitHub
parent 927d7dd9b2
commit beb1c6ae64
253 changed files with 980 additions and 1371 deletions

View File

@@ -1,13 +1,13 @@
use convert_case::{Case, Casing};
use indoc::{formatdoc, indoc};
use proc_macro2::TokenStream as TokenStream2;
use quote::{format_ident, ToTokens};
use quote::{ToTokens, format_ident};
use syn::parse::{Parse, ParseStream, Parser};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::token::{Comma, RArrow};
use syn::{
parse_quote, AttrStyle, Attribute, Error, Expr, ExprTuple, FnArg, GenericParam, Ident, ItemFn, Lit, LitFloat, LitStr, Meta, Pat, PatIdent, PatType, Path, ReturnType, Type, TypeParam, WhereClause,
AttrStyle, Attribute, Error, Expr, ExprTuple, FnArg, GenericParam, Ident, ItemFn, Lit, LitFloat, LitStr, Meta, Pat, PatIdent, PatType, Path, ReturnType, Type, TypeParam, WhereClause, parse_quote,
};
use crate::codegen::generate_node_code;
@@ -519,11 +519,7 @@ fn parse_node_type(ty: &Type) -> (bool, Option<Type>, Option<Type>) {
let input_type = args.args.iter().find_map(|arg| if let syn::GenericArgument::Type(ty) = arg { Some(ty.clone()) } else { None });
let output_type = args.args.iter().find_map(|arg| {
if let syn::GenericArgument::AssocType(assoc_type) = arg {
if assoc_type.ident == "Output" {
Some(assoc_type.ty.clone())
} else {
None
}
if assoc_type.ident == "Output" { Some(assoc_type.ty.clone()) } else { None }
} else {
None
}
@@ -597,8 +593,8 @@ impl ParsedNodeFn {
#[cfg(test)]
mod tests {
use super::*;
use proc_macro2::Span;
use proc_macro_crate::FoundCrate;
use proc_macro2::Span;
use quote::{quote, quote_spanned};
use syn::parse_quote;
fn pat_ident(name: &str) -> PatIdent {