mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 09:58:11 +08:00
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:
co-authored by
Keavon Chambers
parent
927d7dd9b2
commit
beb1c6ae64
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "dyn-any"
|
||||
version = "0.3.1"
|
||||
rust-version = "1.79"
|
||||
edition = "2021"
|
||||
rust-version = "1.85"
|
||||
edition = "2024"
|
||||
authors = ["Graphite Authors <contact@graphite.rs>"]
|
||||
description = "An Any trait that works for arbitrary lifetimes"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "dyn-any-derive"
|
||||
version = "0.3.0"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
authors = ["Graphite Authors <contact@graphite.rs>"]
|
||||
|
||||
description = "#[derive(DynAny)]"
|
||||
|
||||
@@ -5,7 +5,7 @@ extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::Span;
|
||||
use quote::quote;
|
||||
use syn::{parse_macro_input, DeriveInput, GenericParam, Lifetime, LifetimeParam, TypeParamBound};
|
||||
use syn::{DeriveInput, GenericParam, Lifetime, LifetimeParam, TypeParamBound, parse_macro_input};
|
||||
|
||||
/// Derives an implementation for the [`DynAny`] trait.
|
||||
///
|
||||
@@ -62,7 +62,7 @@ fn replace_lifetimes(generics: &syn::Generics, replacement: &str) -> Vec<proc_ma
|
||||
GenericParam::Type(t) => {
|
||||
let mut t = t.clone();
|
||||
t.bounds.iter_mut().for_each(|bond| {
|
||||
if let TypeParamBound::Lifetime(ref mut t) = bond {
|
||||
if let TypeParamBound::Lifetime(t) = bond {
|
||||
*t = Lifetime::new(replacement, Span::call_site())
|
||||
}
|
||||
});
|
||||
|
||||
@@ -187,7 +187,6 @@ macro_rules! impl_slice {
|
||||
|
||||
mod slice {
|
||||
use super::*;
|
||||
|
||||
use core::slice::*;
|
||||
|
||||
impl_slice!(Iter, IterMut, Chunks, ChunksMut, RChunks, RChunksMut, Windows);
|
||||
@@ -249,24 +248,24 @@ impl From<()> for Box<dyn DynAny<'static>> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc::{
|
||||
borrow::Cow,
|
||||
boxed::Box,
|
||||
collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque},
|
||||
string::String,
|
||||
vec::Vec,
|
||||
};
|
||||
use alloc::borrow::Cow;
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc::boxed::Box;
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc::string::String;
|
||||
#[cfg(feature = "alloc")]
|
||||
use alloc::vec::Vec;
|
||||
use core::cell::{Cell, RefCell, UnsafeCell};
|
||||
use core::iter::Empty;
|
||||
use core::marker::{PhantomData, PhantomPinned};
|
||||
use core::mem::{ManuallyDrop, MaybeUninit};
|
||||
use core::num::Wrapping;
|
||||
use core::ops::Range;
|
||||
use core::pin::Pin;
|
||||
use core::sync::atomic::*;
|
||||
use core::{
|
||||
cell::{Cell, RefCell, UnsafeCell},
|
||||
iter::Empty,
|
||||
marker::{PhantomData, PhantomPinned},
|
||||
mem::{ManuallyDrop, MaybeUninit},
|
||||
num::Wrapping,
|
||||
ops::Range,
|
||||
pin::Pin,
|
||||
time::Duration,
|
||||
};
|
||||
use core::time::Duration;
|
||||
|
||||
impl_type!(
|
||||
Option<T>, Result<T, E>, Cell<T>, UnsafeCell<T>, RefCell<T>, MaybeUninit<T>,
|
||||
@@ -286,10 +285,9 @@ impl_type!(
|
||||
);
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
sync::*,
|
||||
};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
#[cfg(feature = "std")]
|
||||
use std::sync::*;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl_type!(Once, Mutex<T>, RwLock<T>, HashSet<T>, HashMap<K, V>);
|
||||
|
||||
Reference in New Issue
Block a user