FIx: cargo fix to clean up things
This commit is contained in:
1 parent
29751a4bab
commit
78d093a945
23 files changed
+91
-101
No files matched your search
@@ -1,12 +1,12 @@
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, quote_spanned, ToTokens};
|
||||
use syn::spanned::Spanned;
|
||||
use quote::{quote, ToTokens};
|
||||
|
||||
use syn::{
|
||||
parse::{Parse, ParseStream},
|
||||
Signature,
|
||||
};
|
||||
use syn::{
|
||||
parse_macro_input, Attribute, Block, FnArg, Ident, Item, ItemFn, ReturnType, Type, Visibility,
|
||||
Attribute, Block, FnArg, Ident, Item, ItemFn, ReturnType, Type, Visibility,
|
||||
};
|
||||
|
||||
/// A parsed version of the user's input
|
||||
@@ -109,11 +109,11 @@ impl ToTokens for FunctionComponent {
|
||||
let FunctionComponent {
|
||||
block,
|
||||
// props_type,
|
||||
arg,
|
||||
vis,
|
||||
attrs,
|
||||
arg: _,
|
||||
vis: _,
|
||||
attrs: _,
|
||||
name: function_name,
|
||||
return_type,
|
||||
return_type: _,
|
||||
} = self;
|
||||
|
||||
// if function_name == component_name {
|
||||
@@ -192,19 +192,19 @@ pub fn ensure_fn_block(item: Item) -> syn::Result<ItemFn> {
|
||||
Item::Fn(it) => Ok(it),
|
||||
Item::Static(it) => {
|
||||
let syn::ItemStatic {
|
||||
attrs,
|
||||
vis,
|
||||
static_token,
|
||||
mutability,
|
||||
ident,
|
||||
colon_token,
|
||||
attrs: _,
|
||||
vis: _,
|
||||
static_token: _,
|
||||
mutability: _,
|
||||
ident: _,
|
||||
colon_token: _,
|
||||
ty,
|
||||
eq_token,
|
||||
expr,
|
||||
semi_token,
|
||||
eq_token: _,
|
||||
expr: _,
|
||||
semi_token: _,
|
||||
} = ⁢
|
||||
match ty.as_ref() {
|
||||
Type::BareFn(bare) => {}
|
||||
Type::BareFn(_bare) => {}
|
||||
// Type::Array(_)
|
||||
// | Type::Group(_)
|
||||
// | Type::ImplTrait(_)
|
||||
|
||||
@@ -147,7 +147,7 @@ struct Element {
|
||||
impl ToTokens for ToToksCtx<&Element> {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
// let ctx = self.ctx;
|
||||
let name = &self.inner.name;
|
||||
let _name = &self.inner.name;
|
||||
tokens.append_all(quote! {
|
||||
dioxus::builder::ElementBuilder::new(ctx, "#name")
|
||||
});
|
||||
@@ -184,7 +184,7 @@ impl Parse for Element {
|
||||
s.parse::<Token![<]>()?;
|
||||
let name = Ident::parse_any(s)?;
|
||||
let mut attrs = vec![];
|
||||
let mut children: Vec<Node> = vec![];
|
||||
let _children: Vec<Node> = vec![];
|
||||
|
||||
// keep looking for attributes
|
||||
while !s.peek(Token![>]) {
|
||||
@@ -293,7 +293,7 @@ impl Parse for Attr {
|
||||
impl ToTokens for ToToksCtx<&Attr> {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
let name = self.inner.name.to_string();
|
||||
let mut attr_stream = TokenStream2::new();
|
||||
let _attr_stream = TokenStream2::new();
|
||||
match &self.inner.ty {
|
||||
AttrType::Value(value) => {
|
||||
let value = self.recurse(value);
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn rsx(s: TokenStream) -> TokenStream {
|
||||
/// }
|
||||
/// ```
|
||||
#[proc_macro_attribute]
|
||||
pub fn fc(attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
pub fn fc(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
match syn::parse::<fc::FunctionComponent>(item) {
|
||||
Err(e) => e.to_compile_error().into(),
|
||||
Ok(s) => s.to_token_stream().into(),
|
||||
|
||||
@@ -10,7 +10,7 @@ use proc_macro2::TokenStream;
|
||||
|
||||
use syn::parse::Error;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
|
||||
use quote::quote;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ impl ToTokens for ToToksCtx<&Component> {
|
||||
// tokens.append_all(quote! {
|
||||
// .finish()
|
||||
// });
|
||||
let toks = tokens.append_all(quote! {
|
||||
let _toks = tokens.append_all(quote! {
|
||||
dioxus::builder::virtual_child(ctx, #name, #builder)
|
||||
});
|
||||
}
|
||||
@@ -209,7 +209,7 @@ impl Parse for Component {
|
||||
syn::braced!(content in s);
|
||||
|
||||
let mut body: Vec<ComponentField> = Vec::new();
|
||||
let mut children: Vec<Node> = Vec::new();
|
||||
let _children: Vec<Node> = Vec::new();
|
||||
|
||||
// parse_element_content(content, &mut attrs, &mut children);
|
||||
|
||||
@@ -228,7 +228,7 @@ impl Parse for Component {
|
||||
|
||||
// eventually we'll parse the attrs
|
||||
// let mut attrs: Vec<Attr> = vec![];
|
||||
let mut children: Vec<Node> = vec![];
|
||||
let children: Vec<Node> = vec![];
|
||||
// parse_element_content(content, &mut attrs, &mut children);
|
||||
|
||||
let children = MaybeExpr::Literal(children);
|
||||
@@ -250,8 +250,8 @@ pub struct ComponentField {
|
||||
|
||||
impl Parse for ComponentField {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let mut name = Ident::parse_any(input)?;
|
||||
let name_str = name.to_string();
|
||||
let name = Ident::parse_any(input)?;
|
||||
let _name_str = name.to_string();
|
||||
input.parse::<Token![:]>()?;
|
||||
let content = input.parse()?;
|
||||
|
||||
@@ -472,7 +472,7 @@ impl ToTokens for ToToksCtx<&Attr> {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
let name = self.inner.name.to_string();
|
||||
let nameident = &self.inner.name;
|
||||
let mut attr_stream = TokenStream2::new();
|
||||
let _attr_stream = TokenStream2::new();
|
||||
match &self.inner.ty {
|
||||
AttrType::Value(value) => {
|
||||
let value = self.recurse(value);
|
||||
|
||||
Reference in new issue
Block a user