Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanceras committed Apr 17, 2024
1 parent 3ac5aa4 commit 056918d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 30 deletions.
30 changes: 14 additions & 16 deletions crates/html-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,21 @@ fn process_node<MSG>(node: &rphtml::parser::Node) -> Result<Option<Node<MSG>>, P
.attrs
.iter()
.filter_map(|attr| {
attr.key
.as_ref()
.and_then(|key| {
let key = String::from_iter(key.content.iter());
if let Some(attr_key) = lookup::match_attribute(&key) {
let value = if let Some(value) = &attr.value {
let value = String::from_iter(value.content.iter());
AttributeValue::Simple(Value::from(value))
} else {
AttributeValue::Empty
};
Some(Attribute::new(None, attr_key, value))
attr.key.as_ref().and_then(|key| {
let key = String::from_iter(key.content.iter());
if let Some(attr_key) = lookup::match_attribute(&key) {
let value = if let Some(value) = &attr.value {
let value = String::from_iter(value.content.iter());
AttributeValue::Simple(Value::from(value))
} else {
log::warn!("Not a standard html attribute: {}", key);
None
}
})
AttributeValue::Empty
};
Some(Attribute::new(None, attr_key, value))
} else {
log::warn!("Not a standard html attribute: {}", key);
None
}
})
})
.collect();

Expand Down
2 changes: 1 addition & 1 deletion examples/experimentals/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//#![deny(warnings)]
use crate::button::{self, Button};
use crate::date_time::{self, DateTimeWidget, date, time};
use crate::date_time::{self, date, time, DateTimeWidget};
use js_sys::Date;
use sauron::dom::component;
use sauron::dom::stateful_component;
Expand Down
8 changes: 1 addition & 7 deletions examples/experimentals/src/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@ impl Component for Button {
}

impl StatefulComponent for Button {
fn attribute_changed(
&mut self,
attr_name: &str,
new_value: Vec<DomAttrValue>,
)
{
}
fn attribute_changed(&mut self, attr_name: &str, new_value: Vec<DomAttrValue>) {}

/// append a child into this component
fn append_children(&mut self, children: Vec<DomNode>) {
Expand Down
7 changes: 1 addition & 6 deletions examples/experimentals/src/date_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,7 @@ where

impl StatefulComponent for DateTimeWidget<()> {
/// this is called when the attributes in the mount is changed
fn attribute_changed(
&mut self,
attr_name: &str,
new_value: Vec<DomAttrValue>,
)
{
fn attribute_changed(&mut self, attr_name: &str, new_value: Vec<DomAttrValue>) {
match &*attr_name {
"time" => {
if let Some(new_value) = new_value[0].as_string() {
Expand Down

0 comments on commit 056918d

Please sign in to comment.