From 4e578e335bf26c062486a36ef05d6370f197d7b8 Mon Sep 17 00:00:00 2001 From: Roland Fredenhagen Date: Mon, 18 Mar 2024 16:39:34 +0100 Subject: [PATCH] chore: update attribute-derive (#2438) --- leptos_macro/Cargo.toml | 2 +- leptos_macro/src/component.rs | 4 ++-- leptos_macro/src/slot.rs | 4 ++-- leptos_macro/tests/ui/component.stderr | 6 ++++-- leptos_macro/tests/ui/component_absolute.stderr | 6 ++++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/leptos_macro/Cargo.toml b/leptos_macro/Cargo.toml index 20f773a9fb..008ef3fdd9 100644 --- a/leptos_macro/Cargo.toml +++ b/leptos_macro/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true proc-macro = true [dependencies] -attribute-derive = { version = "0.8", features = ["syn-full"] } +attribute-derive = { version = "0.9", features = ["syn-full"]} cfg-if = "1" html-escape = "0.2" itertools = "0.12" diff --git a/leptos_macro/src/component.rs b/leptos_macro/src/component.rs index 05b171e92e..ae5386f951 100644 --- a/leptos_macro/src/component.rs +++ b/leptos_macro/src/component.rs @@ -1,4 +1,4 @@ -use attribute_derive::Attribute as AttributeDerive; +use attribute_derive::FromAttr; use convert_case::{ Case::{Pascal, Snake}, Casing, @@ -808,7 +808,7 @@ impl Docs { } } -#[derive(Clone, Debug, AttributeDerive)] +#[derive(Clone, Debug, FromAttr)] #[attribute(ident = prop)] struct PropOpt { #[attribute(conflicts = [optional_no_strip, strip_option])] diff --git a/leptos_macro/src/slot.rs b/leptos_macro/src/slot.rs index 50a3ccb69c..f2b2b60d51 100644 --- a/leptos_macro/src/slot.rs +++ b/leptos_macro/src/slot.rs @@ -1,7 +1,7 @@ use crate::component::{ convert_from_snake_case, drain_filter, is_option, unwrap_option, Docs, }; -use attribute_derive::Attribute as AttributeDerive; +use attribute_derive::FromAttr; use proc_macro2::{Ident, TokenStream}; use quote::{quote, ToTokens, TokenStreamExt}; use syn::{ @@ -179,7 +179,7 @@ impl Prop { } } -#[derive(Clone, Debug, AttributeDerive)] +#[derive(Clone, Debug, FromAttr)] #[attribute(ident = prop)] struct PropOpt { #[attribute(conflicts = [optional_no_strip, strip_option])] diff --git a/leptos_macro/tests/ui/component.stderr b/leptos_macro/tests/ui/component.stderr index 7a425f79ba..96c4b2e7e8 100644 --- a/leptos_macro/tests/ui/component.stderr +++ b/leptos_macro/tests/ui/component.stderr @@ -38,7 +38,9 @@ error: `optional_no_strip` conflicts with mutually exclusive `strip_option` 30 | #[prop(optional_no_strip, strip_option)] conflicting: bool, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: unexpected end of input, expected assignment `=` +error: unexpected end of input, expected `=` or `(` + + = help: try `#[prop(default = 5 * 10)]` --> tests/ui/component.rs:36:40 | 36 | fn default_without_value(#[prop(default)] default: bool) -> impl IntoView { @@ -46,7 +48,7 @@ error: unexpected end of input, expected assignment `=` error: unexpected end of input, expected one of: identifier, `::`, `<`, `_`, literal, `const`, `ref`, `mut`, `&`, parentheses, square brackets, `..`, `const` - = help: try `#[prop(default=5 * 10)]` + = help: try `#[prop(default = 5 * 10)]` --> tests/ui/component.rs:42:22 | 42 | #[prop(default= |)] default: bool, diff --git a/leptos_macro/tests/ui/component_absolute.stderr b/leptos_macro/tests/ui/component_absolute.stderr index 8975dec7de..862c28af21 100644 --- a/leptos_macro/tests/ui/component_absolute.stderr +++ b/leptos_macro/tests/ui/component_absolute.stderr @@ -30,7 +30,9 @@ error: `optional_no_strip` conflicts with mutually exclusive `strip_option` 25 | #[prop(optional_no_strip, strip_option)] conflicting: bool, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: unexpected end of input, expected assignment `=` +error: unexpected end of input, expected `=` or `(` + + = help: try `#[prop(default = 5 * 10)]` --> tests/ui/component_absolute.rs:32:19 | 32 | #[prop(default)] default: bool, @@ -38,7 +40,7 @@ error: unexpected end of input, expected assignment `=` error: unexpected end of input, expected one of: identifier, `::`, `<`, `_`, literal, `const`, `ref`, `mut`, `&`, parentheses, square brackets, `..`, `const` - = help: try `#[prop(default=5 * 10)]` + = help: try `#[prop(default = 5 * 10)]` --> tests/ui/component_absolute.rs:39:22 | 39 | #[prop(default= |)] default: bool,