diff --git a/packages/yew-macro/src/html_tree/html_element.rs b/packages/yew-macro/src/html_tree/html_element.rs index 31545029995..e12b8177fa1 100644 --- a/packages/yew-macro/src/html_tree/html_element.rs +++ b/packages/yew-macro/src/html_tree/html_element.rs @@ -246,13 +246,17 @@ impl ToTokens for HtmlElement { fn apply_as(directive: Option<&PropDirective>) -> TokenStream { match directive { - Some(PropDirective::ApplyAsProperty(token)) => quote_spanned!(token.span()=> ::yew::virtual_dom::ApplyAttributeAs::Property), + Some(PropDirective::ApplyAsProperty(token)) => { + quote_spanned!(token.span()=> ::yew::virtual_dom::ApplyAttributeAs::Property) + } None => quote!(::yew::virtual_dom::ApplyAttributeAs::Attribute), } } /// Try to turn attribute list into a `::yew::virtual_dom::Attributes::Static` - fn try_into_static(src: &[(LitStr, Value, Option)]) -> Option { + fn try_into_static( + src: &[(LitStr, Value, Option)], + ) -> Option { let mut kv = Vec::with_capacity(src.len()); for (k, v, directive) in src.iter() { let v = match v { diff --git a/packages/yew-macro/src/props/prop.rs b/packages/yew-macro/src/props/prop.rs index 7bb3c75b0ea..48f8e9eae77 100644 --- a/packages/yew-macro/src/props/prop.rs +++ b/packages/yew-macro/src/props/prop.rs @@ -26,7 +26,10 @@ pub struct Prop { } impl Parse for Prop { fn parse(input: ParseStream) -> syn::Result { - let directive = input.parse::().map(|parsed| PropDirective::ApplyAsProperty(parsed)).ok(); + let directive = input + .parse::() + .map(|parsed| PropDirective::ApplyAsProperty(parsed)) + .ok(); if input.peek(Brace) { Self::parse_shorthand_prop_assignment(input, directive) } else { @@ -77,7 +80,10 @@ impl Prop { } /// Parse a prop of the form `label={value}` - fn parse_prop_assignment(input: ParseStream, directive: Option) -> syn::Result { + fn parse_prop_assignment( + input: ParseStream, + directive: Option, + ) -> syn::Result { let label = input.parse::()?; let equals = input.parse::().map_err(|_| { syn::Error::new_spanned( @@ -125,8 +131,11 @@ fn parse_prop_value(input: &ParseBuffer) -> syn::Result { Expr::Lit(_) => Ok(expr), ref exp => Err(syn::Error::new_spanned( &expr, - format!("the property value must be either a literal or enclosed in braces. Consider \ - adding braces around your expression.: {:#?}", exp), + format!( + "the property value must be either a literal or enclosed in braces. Consider \ + adding braces around your expression.: {:#?}", + exp + ), )), } } diff --git a/packages/yew/src/dom_bundle/btag/attributes.rs b/packages/yew/src/dom_bundle/btag/attributes.rs index 84cc184d5bc..71d44ae2f01 100644 --- a/packages/yew/src/dom_bundle/btag/attributes.rs +++ b/packages/yew/src/dom_bundle/btag/attributes.rs @@ -367,7 +367,10 @@ mod tests { gloo::timers::future::sleep(Duration::from_secs(1)).await; let element = output.query_selector("a").unwrap().unwrap(); - assert_eq!(element.get_attribute("href").unwrap(), "https://example.com/"); + assert_eq!( + element.get_attribute("href").unwrap(), + "https://example.com/" + ); assert_eq!( Reflect::get(element.as_ref(), &JsValue::from_str("alt"))