Skip to content
Snippets Groups Projects
Commit a16b05f3 authored by MrGVSV's avatar MrGVSV
Browse files

Fix warnings

parent 13867b76
No related branches found
No related tags found
No related merge requests found
Showing
with 24 additions and 43 deletions
...@@ -105,7 +105,7 @@ pub struct BindingContext { ...@@ -105,7 +105,7 @@ pub struct BindingContext {
dependencies: BindingDependencies, dependencies: BindingDependencies,
/// None, or the binding context that this context was created within /// None, or the binding context that this context was created within
nested: Option<Box<BindingContext>>, _nested: Option<Box<BindingContext>>,
} }
impl BindingContext { impl BindingContext {
...@@ -139,7 +139,7 @@ impl BindingContext { ...@@ -139,7 +139,7 @@ impl BindingContext {
let dependencies = BindingDependencies::new(); let dependencies = BindingDependencies::new();
let new_context = BindingContext { let new_context = BindingContext {
dependencies: dependencies.clone(), dependencies: dependencies.clone(),
nested: previous_context.clone().map(Box::new), _nested: previous_context.clone().map(Box::new),
}; };
// Make the current context the same as the new context // Make the current context the same as the new context
......
use proc_macro_error::emit_error;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream, Result}; use syn::parse::{Parse, ParseStream, Result};
use syn::spanned::Spanned;
use crate::widget::Widget; use crate::widget::Widget;
......
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro_error::{emit_error, emit_warning}; use proc_macro_error::emit_error;
use quote::{quote, ToTokens}; use quote::quote;
use syn::{FnArg, Pat, Type}; use syn::{FnArg, Pat, Type};
use syn::spanned::Spanned; use syn::spanned::Spanned;
use crate::get_core_crate; use crate::get_core_crate;
...@@ -15,7 +15,7 @@ impl Default for WidgetArguments { ...@@ -15,7 +15,7 @@ impl Default for WidgetArguments {
} }
} }
pub fn create_function_widget(f: syn::ItemFn, widget_arguments: WidgetArguments) -> TokenStream { pub fn create_function_widget(f: syn::ItemFn, _widget_arguments: WidgetArguments) -> TokenStream {
let struct_name = f.sig.ident.clone(); let struct_name = f.sig.ident.clone();
let (impl_generics, ty_generics, where_clause) = f.sig.generics.split_for_impl(); let (impl_generics, ty_generics, where_clause) = f.sig.generics.split_for_impl();
...@@ -36,25 +36,25 @@ pub fn create_function_widget(f: syn::ItemFn, widget_arguments: WidgetArguments) ...@@ -36,25 +36,25 @@ pub fn create_function_widget(f: syn::ItemFn, widget_arguments: WidgetArguments)
} }
err => { err => {
emit_error!(err.span(), "Expected identifier, but got {:?}", err); emit_error!(err.span(), "Expected identifier, but got {:?}", err);
return TokenStream::new() return TokenStream::new();
} }
}; };
let ty = match *typed.ty.clone() { let ty = match *typed.ty.clone() {
Type::Path(type_path) => { Type::Path(type_path) => {
type_path.path type_path.path
}, }
err => { err => {
emit_error!(err.span(), "Invalid widget prop type: {:?}", err); emit_error!(err.span(), "Invalid widget prop type: {:?}", err);
return TokenStream::new() return TokenStream::new();
} }
}; };
(ident, ty) (ident, ty)
}, }
FnArg::Receiver(receiver) => { FnArg::Receiver(receiver) => {
emit_error!(receiver.span(), "Functional widget cannot use 'self'"); emit_error!(receiver.span(), "Functional widget cannot use 'self'");
return TokenStream::new() return TokenStream::new();
} }
}; };
......
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use proc_macro_error::{emit_error, emit_warning};
use quote::{format_ident, quote}; use quote::{format_ident, quote};
use quote::ToTokens; use quote::ToTokens;
use syn::parse::{Parse, ParseStream, Result}; use syn::parse::{Parse, ParseStream, Result};
use syn::Path; use syn::Path;
use syn::spanned::Spanned;
use crate::widget_builder::build_widget_stream; use crate::widget_builder::build_widget_stream;
use crate::children::Children; use crate::children::Children;
...@@ -110,7 +108,7 @@ impl Widget { ...@@ -110,7 +108,7 @@ impl Widget {
let attrs = attrs.assign_attributes(&prop_ident); let attrs = attrs.assign_attributes(&prop_ident);
let props = quote! { let props = quote! {
let mut #prop_ident = <#name as kayak_core::Widget>::Props::default(); let mut #prop_ident = <#name as #kayak_core::Widget>::Props::default();
#attrs #attrs
}; };
......
use proc_macro_error::{emit_error, emit_warning}; use proc_macro_error::emit_error;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};
use std::collections::HashSet; use std::collections::HashSet;
use proc_macro2::{Ident, TokenStream}; use proc_macro2::{Ident, TokenStream};
...@@ -9,7 +9,6 @@ use syn::{ ...@@ -9,7 +9,6 @@ use syn::{
}; };
use crate::{attribute::Attribute, children::Children, get_core_crate}; use crate::{attribute::Attribute, children::Children, get_core_crate};
use crate::attribute::AttributeKey;
use crate::child::Child; use crate::child::Child;
#[derive(Clone)] #[derive(Clone)]
......
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro2::{Ident}; use proc_macro2::{Ident};
use proc_macro_error::{emit_error, emit_warning}; use proc_macro_error::emit_error;
use quote::quote; use quote::quote;
use syn::{AttributeArgs, Data, DeriveInput, Field, Fields, ItemStruct, Meta, NestedMeta, parse_macro_input, spanned::Spanned}; use syn::{Data, DeriveInput, Field, Meta, NestedMeta, parse_macro_input, spanned::Spanned};
use crate::attribute::Attribute;
use crate::get_core_crate; use crate::get_core_crate;
......
use crate::core::derivative::*;
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp}, styles::{Style, StyleProp},
widget, Children, Fragment, widget, Children, Fragment,
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
Color, OnEvent, rsx, WidgetProps, Color, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
widget, Children, Fragment, widget, Children, Fragment,
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
widget, Children, Fragment, widget, Children,
}; };
#[derive(WidgetProps, Default, Debug, PartialEq, Clone)] #[derive(WidgetProps, Default, Debug, PartialEq, Clone)]
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp}, styles::{Style, StyleProp},
widget, Children, Fragment, widget, Children,
}; };
#[derive(WidgetProps, Default, Debug, PartialEq, Clone)] #[derive(WidgetProps, Default, Debug, PartialEq, Clone)]
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
use_state, widget, Children, EventType, Handler, use_state, widget, Children, EventType, Handler,
......
use crate::core::{ use crate::core::{
render_command::RenderCommand,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp}, styles::{Style},
widget, Children, Fragment, widget, Children,
}; };
#[derive(WidgetProps, Default, Debug, PartialEq, Clone)] #[derive(WidgetProps, Default, Debug, PartialEq, Clone)]
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp}, styles::{Style, StyleProp},
widget, Children, Fragment, widget, Children,
}; };
#[derive(WidgetProps, Default, Debug, PartialEq, Clone)] #[derive(WidgetProps, Default, Debug, PartialEq, Clone)]
......
...@@ -2,7 +2,7 @@ use kayak_core::styles::{PositionType, Style, StyleProp, Units}; ...@@ -2,7 +2,7 @@ use kayak_core::styles::{PositionType, Style, StyleProp, Units};
use kayak_core::{Bound, Color, EventType, OnEvent, VecTracker}; use kayak_core::{Bound, Color, EventType, OnEvent, VecTracker};
use kayak_render_macros::{constructor, use_state}; use kayak_render_macros::{constructor, use_state};
use crate::core::derivative::*;
use crate::core::{rsx, widget, WidgetProps, MutableBound}; use crate::core::{rsx, widget, WidgetProps, MutableBound};
use crate::widgets::{Background, Button, Text}; use crate::widgets::{Background, Button, Text};
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
layout_cache::Space, layout_cache::Space,
derivative::Derivative,
OnEvent, rsx, WidgetProps, OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp}, styles::{Style, StyleProp},
widget, Children, Fragment, widget, Children,
}; };
#[derive(WidgetProps, Default, Debug, PartialEq, Clone)] #[derive(WidgetProps, Default, Debug, PartialEq, Clone)]
......
...@@ -3,10 +3,9 @@ use kayak_font::{CoordinateSystem, KayakFont}; ...@@ -3,10 +3,9 @@ use kayak_font::{CoordinateSystem, KayakFont};
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative, OnEvent, WidgetProps,
OnEvent, rsx, WidgetProps,
styles::{Style, StyleProp}, styles::{Style, StyleProp},
widget, Children, Fragment, widget,
}; };
#[derive(WidgetProps, Default, Debug, PartialEq, Clone)] #[derive(WidgetProps, Default, Debug, PartialEq, Clone)]
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
Children, rsx, WidgetProps, Children, rsx, WidgetProps,
styles::{Style, StyleProp, Units}, styles::{Style, StyleProp, Units},
widget, Bound, Color, EventType, MutableBound, OnEvent, widget, Bound, Color, EventType, MutableBound, OnEvent,
......
use crate::core::{ use crate::core::{
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
rsx, WidgetProps, rsx, WidgetProps,
styles::{PositionType, Style, StyleProp, Units}, styles::{PositionType, Style, StyleProp, Units},
widget, Bound, Children, Color, EventType, MutableBound, OnEvent, widget, Bound, Children, Color, EventType, MutableBound, OnEvent,
......
use crate::core::{ use crate::core::{
color::Color, color::Color,
render_command::RenderCommand, render_command::RenderCommand,
derivative::Derivative,
rsx, WidgetProps, rsx, WidgetProps,
styles::{PositionType, Style, StyleProp, Units}, styles::{PositionType, Style, StyleProp, Units},
use_state, widget, Children, EventType, OnEvent, use_state, widget, Children, EventType, OnEvent,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment