Skip to content

Commit

Permalink
cargo clippy --fix -- --allow unused_braces
Browse files Browse the repository at this point in the history
- The '--allow unused_braces' is to avoid removing the extra curly
  braces used within html! macro calls.
  • Loading branch information
dgellow authored and bodil committed Jan 27, 2022
1 parent d1525a3 commit 9d5f32b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions examples/dodrio/todomvc/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ impl Deref for AutoCommitTodos<'_> {
type Target = Todos;

fn deref(&self) -> &Todos {
&self.todos
self.todos
}
}

impl DerefMut for AutoCommitTodos<'_> {
fn deref_mut(&mut self) -> &mut Todos {
&mut self.todos
self.todos
}
}
2 changes: 1 addition & 1 deletion examples/dodrio/todomvc/src/todo.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Type definition and `dodrio::Render` implementation for a single todo item.
use crate::keys;
use dodrio::{bumpalo::Bump, Node, Render, RenderContext, RootRender, VdomWeak};
use dodrio::{Node, Render, RenderContext, RootRender, VdomWeak};
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;
use typed_html::dodrio;
Expand Down
4 changes: 2 additions & 2 deletions examples/dodrio/todomvc/src/todos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use dodrio::{
};
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;
use std::mem;

use typed_html::dodrio;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
Expand Down Expand Up @@ -123,7 +123,7 @@ impl<C> Todos<C> {

/// Take the current draft text and replace it with an empty 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.
Expand Down
6 changes: 3 additions & 3 deletions macros/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn pprint_token(token: &str) -> &str {
}

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 {
let start = tokens[..tokens.len() - 1].join(", ");
let end = &tokens[tokens.len() - 1];
Expand Down Expand Up @@ -52,7 +52,7 @@ pub fn parse_error(input: &[Token], error: &ParseError) -> TokenStream {
UnrecognizedEOF { expected, .. } => {
let msg = format!(
"unexpected end of macro; missing {}",
pprint_tokens(&expected)
pprint_tokens(expected)
);
quote! {
compile_error! { #msg }
Expand All @@ -63,7 +63,7 @@ pub fn parse_error(input: &[Token], error: &ParseError) -> TokenStream {
expected,
} => {
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=>
compile_error! { #error_msg }
};
Expand Down
2 changes: 1 addition & 1 deletion macros/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Element {
}
for (key, value) in data_attrs
.iter()
.map(|(k, v)| (TokenTree::from(Literal::string(&k)), v.clone()))
.map(|(k, v)| (TokenTree::from(Literal::string(k)), v.clone()))
{
body.extend(quote!(
element.data_attributes.push((#key, #value.into()));
Expand Down
4 changes: 2 additions & 2 deletions macros/src/span.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use proc_macro;
use proc_macro2;



pub fn from_unstable(span: proc_macro::Span) -> proc_macro2::Span {
let ident = proc_macro::Ident::new("_", span);
Expand Down
6 changes: 3 additions & 3 deletions typed-html/src/output/stdweb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ impl Stdweb {
vnode: VNode<'_, Stdweb>,
) -> Result<web::Node, web::error::InvalidCharacterError> {
match vnode {
VNode::Text(text) => Ok(document.create_text_node(&text).into()),
VNode::UnsafeText(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::Element(element) => {
let mut node = document.create_element(element.name)?;
for (key, value) in element.attributes {
node.set_attribute(&key, &value)?;
node.set_attribute(key, &value)?;
}
Stdweb::install_handlers(&mut node, element.events);
for child in element.children {
Expand Down

0 comments on commit 9d5f32b

Please sign in to comment.