fix clippy (#2492)

This commit is contained in:
Julius Lungys 2022-03-05 21:53:19 +02:00 committed by GitHub
parent 3a11f15ec5
commit 221b4dfa51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 25 deletions

View File

@ -54,7 +54,7 @@ impl Component for Slider {
step,
} = *ctx.props();
let precision = precision.unwrap_or_else(|| if percentage { 1 } else { 0 });
let precision = precision.unwrap_or(if percentage { 1 } else { 0 });
let display_value = if percentage {
format!("{:.p$}%", 100.0 * value, p = precision)

View File

@ -53,18 +53,12 @@ pub fn render_markdown(src: &str) -> Html {
pre.add_child(top.into());
top = pre;
} else if let Tag::Table(aligns) = tag {
for r in top
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
{
for r in top.children_mut().iter_mut().flat_map(|ch| ch.iter_mut()) {
if let VNode::VTag(ref mut vtag) = r {
for (i, c) in vtag
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
.flat_map(|ch| ch.iter_mut())
.enumerate()
{
if let VNode::VTag(ref mut vtag) = c {
@ -79,12 +73,7 @@ pub fn render_markdown(src: &str) -> Html {
}
}
} else if let Tag::TableHead = tag {
for c in top
.children_mut()
.iter_mut()
.map(|ch| ch.iter_mut())
.flatten()
{
for c in top.children_mut().iter_mut().flat_map(|ch| ch.iter_mut()) {
if let VNode::VTag(ref mut vtag) = c {
// TODO
// vtag.tag = "th".into();

View File

@ -478,8 +478,7 @@ impl Registry {
fn handle(desc: EventDescriptor, event: Event) {
let target = match event
.target()
.map(|el| el.dyn_into::<web_sys::Element>().ok())
.flatten()
.and_then(|el| el.dyn_into::<web_sys::Element>().ok())
{
Some(el) => el,
None => return,
@ -492,18 +491,15 @@ impl Registry {
let run_handler = |el: &web_sys::Element| {
if let Some(l) = LISTENER_ID_PROP
.with(|prop| js_sys::Reflect::get(el, prop).ok())
.map(|v| v.dyn_into().ok())
.flatten()
.map(|num: js_sys::Number| {
.and_then(|v| v.dyn_into().ok())
.and_then(|num: js_sys::Number| {
Registry::with(|r| {
r.by_id
.get(&(num.value_of() as u32))
.map(|s| s.get(&desc))
.flatten()
.and_then(|s| s.get(&desc))
.cloned()
})
})
.flatten()
{
for l in l {
l.handle(event.clone());

View File

@ -20,7 +20,7 @@ fn main() -> Result<()> {
let transformed_benchmarks: Vec<GhActionBenchmark> = input_json
.into_iter()
.map(|v| GhActionBenchmark {
name: format!("{} {}", v["framework"], v["benchmark"]).replace("\"", ""),
name: format!("{} {}", v["framework"], v["benchmark"]).replace('\"', ""),
unit: String::default(),
value: v["median"].to_string(),
})

View File

@ -86,7 +86,7 @@ impl Level {
.unwrap()
.to_str()
.unwrap()
.replace("-", "_");
.replace('-', "_");
self.write_space(dst, level);