FIx: cargo fix to clean up things

This commit is contained in:
Jonathan Kelley committed 2021-03-10 19:42:31 -05:00
1 parent 29751a4bab
commit 78d093a945
23 files changed
+91 -101

No files matched your search

+1 -1
View File
@@ -1,3 +1,3 @@
use dioxus_core_macro::fc;
fn main() {}
+10 -10
View File
@@ -1,4 +1,4 @@
use dioxus_core_macro::rsx;
pub mod dioxus {
pub mod builder {
@@ -25,32 +25,32 @@ pub mod dioxus {
impl Builder {
// fn attr<T>(mut self, key: &str, value: impl Into<AttrVal>) -> Self {
pub fn attr<T>(mut self, key: &str, value: T) -> Self {
pub fn attr<T>(self, _key: &str, _value: T) -> Self {
Self
}
pub fn on<T>(mut self, key: &str, value: T) -> Self {
pub fn on<T>(self, _key: &str, _value: T) -> Self {
Self
}
pub fn finish(mut self) {
pub fn finish(self) {
// Self
}
}
pub struct Bump;
pub fn div(bump: &Bump) -> Builder {
pub fn div(_bump: &Bump) -> Builder {
todo!()
}
pub fn h1(bump: &Bump) -> Builder {
pub fn h1(_bump: &Bump) -> Builder {
todo!()
}
pub fn h2(bump: &Bump) -> Builder {
pub fn h2(_bump: &Bump) -> Builder {
todo!()
}
}
}
use dioxus::builder::Bump;
pub fn main() {
// render(rsx! {
// div { // we can actually support just a list of nodes too
@@ -86,7 +86,7 @@ pub fn main() {
// }
// });
let g = String::from("asd");
let _g = String::from("asd");
// let lazy = rsx! {
// div {
@@ -124,4 +124,4 @@ pub fn main() {
// render(lazy);
}
fn render(f: impl Fn(&dioxus::builder::Bump)) {}
fn render(_f: impl Fn(&dioxus::builder::Bump)) {}
+17 -17
View File
@@ -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: _,
} = &it;
match ty.as_ref() {
Type::BareFn(bare) => {}
Type::BareFn(_bare) => {}
// Type::Array(_)
// | Type::Group(_)
// | Type::ImplTrait(_)
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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(),
+1 -1
View File
@@ -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;
+6 -6
View File
@@ -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);