Remove paste dependency

https://rustsec.org/advisories/RUSTSEC-2024-0436.html
This commit is contained in:
En-En 2025-03-17 14:07:46 +00:00 committed by Shawn Wallace
parent beb7c3ebe0
commit cca74a5f6b
4 changed files with 20 additions and 37 deletions

7
Cargo.lock generated
View file

@ -339,12 +339,6 @@ version = "1.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.31" version = "0.3.31"
@ -838,7 +832,6 @@ dependencies = [
"libc", "libc",
"log", "log",
"macros", "macros",
"paste",
"pretty_env_logger", "pretty_env_logger",
"rustix", "rustix",
"sd-notify", "sd-notify",

View file

@ -23,7 +23,6 @@ crate-type = ["lib"]
[dependencies] [dependencies]
bitflags = "2.5.0" bitflags = "2.5.0"
paste = "1.0.14"
rustix = { workspace = true, features = ["event"] } rustix = { workspace = true, features = ["event"] }
wayland-client.workspace = true wayland-client.workspace = true
wayland-protocols = { workspace = true, features = ["client", "server", "staging", "unstable"] } wayland-protocols = { workspace = true, features = ["client", "server", "staging", "unstable"] }

View file

@ -308,7 +308,7 @@ macro_rules! handle_event_enum {
$(#[$meta:meta])* $(#[$meta:meta])*
$pub:vis enum $name:ident { $pub:vis enum $name:ident {
$( $variant:ident($ty:ty) ),+ $( $variant:ident($ty:ty) ),+
} } => $name_event:ident
) => { ) => {
enum_try_from! { enum_try_from! {
$(#[$meta])* $(#[$meta])*
@ -317,19 +317,15 @@ macro_rules! handle_event_enum {
} }
} }
paste::paste! {
enum_try_from! { enum_try_from! {
#[derive(Debug)] #[derive(Debug)]
$pub enum [<$name Event>] { $pub enum $name_event {
$( $variant(<$ty as HandleEvent>::Event) ),+ $( $variant(<$ty as HandleEvent>::Event) ),+
} }
} }
}
impl HandleEvent for $name { impl HandleEvent for $name {
paste::paste! { type Event = $name_event;
type Event = [<$name Event>];
}
fn handle_event<C: XConnection>(&mut self, event: Self::Event, state: &mut ServerState<C>) { fn handle_event<C: XConnection>(&mut self, event: Self::Event, state: &mut ServerState<C>) {
match self { match self {
@ -370,7 +366,7 @@ pub(crate) enum Object {
TabletPadGroup(TabletPadGroup), TabletPadGroup(TabletPadGroup),
TabletPadRing(TabletPadRing), TabletPadRing(TabletPadRing),
TabletPadStrip(TabletPadStrip) TabletPadStrip(TabletPadStrip)
} } => ObjectEvent
} }

View file

@ -1,6 +1,5 @@
use super::{ServerState, WindowDims}; use super::{ServerState, WindowDims};
use crate::xstate::{SetState, WmName}; use crate::xstate::{SetState, WmName};
use paste::paste;
use rustix::event::{poll, PollFd, PollFlags}; use rustix::event::{poll, PollFd, PollFlags};
use std::collections::HashMap; use std::collections::HashMap;
use std::io::Write; use std::io::Write;
@ -71,7 +70,7 @@ macro_rules! with_optional {
$( $(
$field:ident: $type:ty $field:ident: $type:ty
),+$(,)? ),+$(,)?
} } => $name_optional:ident
) => { ) => {
$( #[$attr] )? $( #[$attr] )?
struct $name$(<$($lifetimes),+>)? { struct $name$(<$($lifetimes),+>)? {
@ -80,18 +79,15 @@ macro_rules! with_optional {
),+ ),+
} }
paste! {
#[derive(Default)] #[derive(Default)]
struct [< $name Optional >] { struct $name_optional {
$( $(
$field: Option<$type> $field: Option<$type>
),+ ),+
} }
}
paste! { impl From<$name_optional> for $name {
impl From<[<$name Optional>]> for $name { fn from(opt: $name_optional) -> Self {
fn from(opt: [<$name Optional>]) -> Self {
Self { Self {
$( $(
$field: opt.$field.expect(concat!("uninitialized field ", stringify!($field))) $field: opt.$field.expect(concat!("uninitialized field ", stringify!($field)))
@ -101,7 +97,6 @@ macro_rules! with_optional {
} }
} }
} }
}
with_optional! { with_optional! {
@ -111,7 +106,7 @@ struct Compositor {
shell: TestObject<XwaylandShellV1>, shell: TestObject<XwaylandShellV1>,
seat: TestObject<WlSeat>, seat: TestObject<WlSeat>,
tablet_man: TestObject<ZwpTabletManagerV2> tablet_man: TestObject<ZwpTabletManagerV2>
} } => CompositorOptional
} }