wip: eliminate warnings

This commit is contained in:
Jonathan Kelley committed 2022-06-28 15:15:09 -04:00
1 parent a825cdcf58
commit 1e4af430a8
8 files changed
+28 -212

No files matched your search

+10 -13
View File
@@ -1,35 +1,32 @@
use dioxus_rsx::*;
use std::fmt::Write;
// todo: use recursive or complete sizeing
pub fn extract_attr_len(attributes: &[ElementAttrNamed]) -> usize {
attributes
.iter()
.map(|attr| match &attr.attr {
ElementAttr::AttrText { name, value } => value.value().len(),
ElementAttr::AttrExpression { name, value } => 10,
ElementAttr::CustomAttrText { name, value } => value.value().len(),
ElementAttr::CustomAttrExpression { name, value } => 10,
ElementAttr::EventTokens { name, tokens } => 1000000,
ElementAttr::AttrText { value, .. } => value.value().len(),
ElementAttr::AttrExpression { .. } => 10,
ElementAttr::CustomAttrText { value, .. } => value.value().len(),
ElementAttr::CustomAttrExpression { .. } => 10,
ElementAttr::EventTokens { .. } => 1000000,
})
.sum()
}
pub fn find_bracket_end(contents: &str) -> Option<usize> {
let mut depth = 0;
let mut i = 0;
for c in contents.chars() {
for (i, c) in contents.chars().enumerate() {
if c == '{' {
depth += 1;
} else if c == '}' {
depth -= 1;
}
if depth == 0 {
return Some(i);
if depth == 0 {
return Some(i);
}
}
i += 1;
}
None