Updating paste macro usage (#3334)

This commit is contained in:
Wojciech Daniło 2022-03-22 11:43:14 +01:00 committed by GitHub
parent a87b2021a3
commit ccaf24877f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 19 additions and 21 deletions

1
Cargo.lock generated
View File

@ -1300,7 +1300,6 @@ dependencies = [
"nalgebra 0.26.2",
"num-traits",
"num_enum",
"paste 1.0.6",
"rustc-hash",
"shrinkwraprs 0.3.0",
"smallvec 1.8.0",

View File

@ -38,7 +38,6 @@ js-sys = { version = "0.3.28" }
nalgebra = { version = "0.26.1" }
num_enum = { version = "0.5.1" }
num-traits = { version = "0.2" }
paste = { version = "1.0.5" }
rustc-hash = { version = "1.0.1" }
shrinkwraprs = { version = "0.3.0" }
smallvec = { version = "1.0.0" }

View File

@ -32,7 +32,7 @@ pub trait CloneableFnEasing = 'static + Clone + Fn(f32) -> f32;
macro_rules! define_in_out_easing_fn {
(fn $tname:ident $name:ident $lambda:expr) => {
paste::item! {
paste! {
/// A $name-in function type.
pub type [<$tname In>] = impl Clone + Fn(f32) -> f32;
/// A $name-out function type.

View File

@ -73,7 +73,7 @@ macro_rules! closure {
($($larg:ident : $larg_type:ty),*)
-> $type:ident
$body:tt
) => { paste::item! {
) => { paste! {
#[cfg(not(feature = "no_unboxed_callbacks"))]
/// Closure type.
pub type $type<$($param),*> =

View File

@ -152,7 +152,7 @@ macro_rules! emit_if_integer {
/// Emits the StatsData struct, and extends StatsWithTimeProvider with accessors to StatsData
/// fields.
macro_rules! gen_stats {
($($field:ident : $field_type:ty),* $(,)?) => { paste::item! {
($($field:ident : $field_type:ty),* $(,)?) => { paste! {
// === StatsData ===

View File

@ -1,5 +1,5 @@
//! The core vector rendering engine for EnsoGL, a blazing fast 2D drawing library. This crate
//! contains the core utilities necessary for the rendering engine to run correctly. See thr docs
//! contains the core utilities necessary for the rendering engine to run correctly. See the docs
//! of the `ensogl` crate to learn more.
#![recursion_limit = "512"]

View File

@ -410,7 +410,7 @@ use enum_dispatch::*;
pub struct BadVariant;
macro_rules! define_any_buffer {
([] [$([$base:ident $param:ident])*]) => { paste::item! {
([] [$([$base:ident $param:ident])*]) => { paste! {
/// An enum with a variant per possible buffer type (i32, f32, Vector<f32>,
/// and many, many more). It provides a faster alternative to dyn trait one:

View File

@ -237,7 +237,7 @@ impl<T> WithContent for Uniform<T> {
pub struct TypeMismatch;
macro_rules! define_any_prim_uniform {
( [] [$([$t1:ident $t2:ident])*] ) => { paste::item! {
( [] [$([$t1:ident $t2:ident])*] ) => { paste! {
/// Existentially typed uniform value.
#[allow(non_camel_case_types)]
#[enum_dispatch(AnyPrimUniformOps)]
@ -285,7 +285,7 @@ impl<Value: UniformUpload> AnyPrimUniformOps for UniformData<Value> {
// =========================
macro_rules! define_any_texture_uniform {
( [ $([$storage:ident $internal_format:ident $item_type:ident])* ] ) => { paste::item! {
( [ $([$storage:ident $internal_format:ident $item_type:ident])* ] ) => { paste! {
#[allow(non_camel_case_types)]
#[derive(Clone,CloneRef,Debug)]
pub enum AnyTextureUniform {

View File

@ -278,9 +278,9 @@ macro_rules! examples {
($($name:ident),*) => {$(
std::mem::forget(Example::new(
stringify!($name),
paste::expr!{[<$name _in>]()},
paste::expr!{[<$name _out>]()},
paste::expr!{[<$name _in_out>]()},
paste!{[<$name _in>]()},
paste!{[<$name _out>]()},
paste!{[<$name _in_out>]()},
));
)*};
}

View File

@ -402,13 +402,13 @@ macro_rules! define_global_processor {
/// Global processor definition.
#[derive(Copy, Clone, Debug, Default)]
pub struct $name;
paste::item! {
paste! {
#[allow(non_upper_case_globals)]
static mut [<$name _STATIC_MUT>]: Option<$tp> = None;
}
impl GlobalProcessor for $name {
type Processor = $tp;
paste::item! {
paste! {
#[allow(unsafe_code)]
fn get_mut() -> &'static mut Self::Processor {
unsafe {

View File

@ -322,7 +322,7 @@ impl<T> HasLens for T {}
macro_rules! mk_lens_field_decl {
($struct_name:ident<$($param:ident),*>{$field_name:ident : $field_type:ty}) => {
paste::item! {
paste! {
// struct FIELD_bar;
struct [<FIELD_ $field_name>];
@ -336,7 +336,7 @@ paste::item! {
macro_rules! mk_lenses_for {
($struct_name:ident<$($param:ident),*>{$field_name:ident : $field_type:ty}) => {
paste::item! {
paste! {
mk_lens_field_decl!($struct_name<$($param),*>{$field_name:$field_type});
@ -423,7 +423,7 @@ paste::item! {
}};
($struct_name:ident<$($param:ident),*> :: $cons_name:ident {$field_name:ident : $field_type:ty}) => {
paste::item! {
paste! {
mk_lens_field_decl!($struct_name<$($param),*>{$field_name:$field_type});

View File

@ -37,7 +37,7 @@ itertools = "0.10.0"
lazy_static = "1.4"
num = "0.4.0"
object = { version = "0.24.0" }
paste = "1.0.5"
paste = "1.0"
shrinkwraprs = "0.3.0"
serde = { version = "1.0.126", features = ["derive", "rc"], optional = true }
serde_json = { version = "1.0", optional = true }

View File

@ -76,7 +76,7 @@ pub use ifmt::*;
pub use itertools::Itertools;
pub use lazy_static::lazy_static;
pub use num::Num;
pub use paste;
pub use paste::paste;
pub use shrinkwraprs::Shrinkwrap;
pub use weak_table;
pub use weak_table::traits::WeakElement;
@ -190,7 +190,7 @@ where
#[macro_export]
macro_rules! clone_boxed {
( $name:ident ) => {
paste::item! {
paste! {
#[allow(missing_docs)]
pub trait [<CloneBoxedFor $name>] {
fn clone_boxed(&self) -> Box<dyn $name>;

View File

@ -210,7 +210,7 @@ macro_rules! shared_struct {
}
}
paste::item! {
paste! {
$(#[$($meta)*])*
#[derive(CloneRef)]
pub struct [<Weak $name>] <$($params)*> { weak: Weak<RefCell<$name_mut<$($params)*>>> }