chore: clippy

This commit is contained in:
Greg Johnston 2024-08-26 20:57:02 -04:00
parent ba1ea4c2bb
commit 55fd7c6421
3 changed files with 9 additions and 6 deletions

View file

@ -3,7 +3,8 @@ use crate::view::attribute_absolute;
use proc_macro2::{Ident, TokenStream, TokenTree};
use quote::{format_ident, quote, quote_spanned};
use rstml::node::{
CustomNode, KeyedAttributeValue, NodeAttribute, NodeBlock, NodeElement, NodeName
CustomNode, KeyedAttributeValue, NodeAttribute, NodeBlock, NodeElement,
NodeName,
};
use std::collections::HashMap;
use syn::{spanned::Spanned, Expr, ExprPath, ExprRange, RangeLimits, Stmt};
@ -151,7 +152,7 @@ pub(crate) fn component_to_tokens(
}
}))
} else if let NodeAttribute::Attribute(node) = attr {
attribute_absolute(&node, idx >= spread_marker)
attribute_absolute(node, idx >= spread_marker)
} else {
None
}

View file

@ -299,7 +299,7 @@ pub(crate) fn element_to_tokens(
}
}
NodeAttribute::Attribute(node) => {
if let Some(content) = attribute_absolute(&node, true) {
if let Some(content) = attribute_absolute(node, true) {
attributes.push(content);
}
}

View file

@ -32,7 +32,7 @@ pub(crate) fn slot_to_tokens(
let attrs = node.attributes().iter().filter_map(|node| {
if let NodeAttribute::Attribute(node) = node {
if is_slot(&node) {
if is_slot(node) {
None
} else {
Some(node)
@ -213,10 +213,12 @@ pub(crate) fn is_slot(node: &KeyedAttribute) -> bool {
key == "slot" || key.starts_with("slot:")
}
pub(crate) fn get_slot(node: &NodeElement<impl CustomNode>) -> Option<&KeyedAttribute> {
pub(crate) fn get_slot(
node: &NodeElement<impl CustomNode>,
) -> Option<&KeyedAttribute> {
node.attributes().iter().find_map(|node| {
if let NodeAttribute::Attribute(node) = node {
if is_slot(&node) {
if is_slot(node) {
Some(node)
} else {
None