cargo clippy --fix -- --allow unused_braces
- The '--allow unused_braces' is to avoid removing the extra curly braces used within html! macro calls.
This commit is contained in:
parent
d1525a38ff
commit
9d5f32ba9b
|
@ -129,12 +129,12 @@ impl Deref for AutoCommitTodos<'_> {
|
||||||
type Target = Todos;
|
type Target = Todos;
|
||||||
|
|
||||||
fn deref(&self) -> &Todos {
|
fn deref(&self) -> &Todos {
|
||||||
&self.todos
|
self.todos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DerefMut for AutoCommitTodos<'_> {
|
impl DerefMut for AutoCommitTodos<'_> {
|
||||||
fn deref_mut(&mut self) -> &mut Todos {
|
fn deref_mut(&mut self) -> &mut Todos {
|
||||||
&mut self.todos
|
self.todos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! Type definition and `dodrio::Render` implementation for a single todo item.
|
//! Type definition and `dodrio::Render` implementation for a single todo item.
|
||||||
|
|
||||||
use crate::keys;
|
use crate::keys;
|
||||||
use dodrio::{bumpalo::Bump, Node, Render, RenderContext, RootRender, VdomWeak};
|
use dodrio::{Node, Render, RenderContext, RootRender, VdomWeak};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use typed_html::dodrio;
|
use typed_html::dodrio;
|
||||||
|
|
|
@ -13,7 +13,7 @@ use dodrio::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem;
|
|
||||||
use typed_html::dodrio;
|
use typed_html::dodrio;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen::JsCast;
|
use wasm_bindgen::JsCast;
|
||||||
|
@ -123,7 +123,7 @@ impl<C> Todos<C> {
|
||||||
|
|
||||||
/// Take the current draft text and replace it with an empty string.
|
/// Take the current draft text and replace it with an empty string.
|
||||||
pub fn take_draft(&mut self) -> String {
|
pub fn take_draft(&mut self) -> String {
|
||||||
mem::replace(&mut self.draft, String::new())
|
std::mem::take(&mut self.draft)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current visibility for these todos.
|
/// Get the current visibility for these todos.
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn pprint_token(token: &str) -> &str {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pprint_tokens(tokens: &[String]) -> String {
|
fn pprint_tokens(tokens: &[String]) -> String {
|
||||||
let tokens: Vec<&str> = tokens.iter().map(|s| pprint_token(&s)).collect();
|
let tokens: Vec<&str> = tokens.iter().map(|s| pprint_token(s)).collect();
|
||||||
if tokens.len() > 1 {
|
if tokens.len() > 1 {
|
||||||
let start = tokens[..tokens.len() - 1].join(", ");
|
let start = tokens[..tokens.len() - 1].join(", ");
|
||||||
let end = &tokens[tokens.len() - 1];
|
let end = &tokens[tokens.len() - 1];
|
||||||
|
@ -52,7 +52,7 @@ pub fn parse_error(input: &[Token], error: &ParseError) -> TokenStream {
|
||||||
UnrecognizedEOF { expected, .. } => {
|
UnrecognizedEOF { expected, .. } => {
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"unexpected end of macro; missing {}",
|
"unexpected end of macro; missing {}",
|
||||||
pprint_tokens(&expected)
|
pprint_tokens(expected)
|
||||||
);
|
);
|
||||||
quote! {
|
quote! {
|
||||||
compile_error! { #msg }
|
compile_error! { #msg }
|
||||||
|
@ -63,7 +63,7 @@ pub fn parse_error(input: &[Token], error: &ParseError) -> TokenStream {
|
||||||
expected,
|
expected,
|
||||||
} => {
|
} => {
|
||||||
let span = token.span();
|
let span = token.span();
|
||||||
let error_msg = format!("expected {}", pprint_tokens(&expected));
|
let error_msg = format!("expected {}", pprint_tokens(expected));
|
||||||
let error = quote_spanned! {span=>
|
let error = quote_spanned! {span=>
|
||||||
compile_error! { #error_msg }
|
compile_error! { #error_msg }
|
||||||
};
|
};
|
||||||
|
|
|
@ -240,7 +240,7 @@ impl Element {
|
||||||
}
|
}
|
||||||
for (key, value) in data_attrs
|
for (key, value) in data_attrs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(k, v)| (TokenTree::from(Literal::string(&k)), v.clone()))
|
.map(|(k, v)| (TokenTree::from(Literal::string(k)), v.clone()))
|
||||||
{
|
{
|
||||||
body.extend(quote!(
|
body.extend(quote!(
|
||||||
element.data_attributes.push((#key, #value.into()));
|
element.data_attributes.push((#key, #value.into()));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use proc_macro;
|
|
||||||
use proc_macro2;
|
|
||||||
|
|
||||||
pub fn from_unstable(span: proc_macro::Span) -> proc_macro2::Span {
|
pub fn from_unstable(span: proc_macro::Span) -> proc_macro2::Span {
|
||||||
let ident = proc_macro::Ident::new("_", span);
|
let ident = proc_macro::Ident::new("_", span);
|
||||||
|
|
|
@ -173,12 +173,12 @@ impl Stdweb {
|
||||||
vnode: VNode<'_, Stdweb>,
|
vnode: VNode<'_, Stdweb>,
|
||||||
) -> Result<web::Node, web::error::InvalidCharacterError> {
|
) -> Result<web::Node, web::error::InvalidCharacterError> {
|
||||||
match vnode {
|
match vnode {
|
||||||
VNode::Text(text) => Ok(document.create_text_node(&text).into()),
|
VNode::Text(text) => Ok(document.create_text_node(text).into()),
|
||||||
VNode::UnsafeText(text) => Ok(document.create_text_node(&text).into()),
|
VNode::UnsafeText(text) => Ok(document.create_text_node(text).into()),
|
||||||
VNode::Element(element) => {
|
VNode::Element(element) => {
|
||||||
let mut node = document.create_element(element.name)?;
|
let mut node = document.create_element(element.name)?;
|
||||||
for (key, value) in element.attributes {
|
for (key, value) in element.attributes {
|
||||||
node.set_attribute(&key, &value)?;
|
node.set_attribute(key, &value)?;
|
||||||
}
|
}
|
||||||
Stdweb::install_handlers(&mut node, element.events);
|
Stdweb::install_handlers(&mut node, element.events);
|
||||||
for child in element.children {
|
for child in element.children {
|
||||||
|
|
Loading…
Reference in New Issue