Auto-fixed clippy::needless_return

`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.

See https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_return

cargo fmt --all
```
This commit is contained in:
Yuri Astrakhan 2025-02-07 01:22:32 -05:00 committed by Olivier Goffart
parent 9621cae218
commit 05f4fc0cde
14 changed files with 41 additions and 55 deletions

View file

@ -128,9 +128,9 @@ impl JsComponentCompiler {
))),
);
return Some((name.to_string(), struct_instance.ok()?));
Some((name.to_string(), struct_instance.ok()?))
}
_ => return None,
_ => None,
}
}
@ -156,9 +156,9 @@ impl JsComponentCompiler {
)
.ok()?;
}
return Some((en.name.to_string(), o.into_unknown()));
Some((en.name.to_string(), o.into_unknown()))
}
_ => return None,
_ => None,
}
}

View file

@ -306,10 +306,10 @@ fn brush_from_color(rgb_color: Object) -> Result<Value> {
return Err(Error::from_reason("A channel of Color cannot be negative"));
}
return Ok(Value::Brush(Brush::SolidColor(Color::from_argb_u8(
Ok(Value::Brush(Brush::SolidColor(Color::from_argb_u8(
alpha as u8,
red as u8,
green as u8,
blue as u8,
))));
))))
}

View file

@ -286,21 +286,16 @@ impl SlintBrush {
#[napi]
pub fn to_string(&self) -> String {
match &self.inner {
Brush::SolidColor(_) => {
return self.slint_color().to_string();
}
Brush::SolidColor(_) => self.slint_color().to_string(),
Brush::LinearGradient(gradient) => {
return format!(
format!(
"linear-gradient({}deg, {})",
gradient.angle(),
gradient_stops_to_string(gradient.stops())
);
)
}
Brush::RadialGradient(gradient) => {
return format!(
"radial-gradient(circle, {})",
gradient_stops_to_string(gradient.stops())
);
format!("radial-gradient(circle, {})", gradient_stops_to_string(gradient.stops()))
}
_ => String::default(),
}

View file

@ -277,6 +277,6 @@ impl ModelIterator {
self.model.row_data(row).and_then(|value| to_js_unknown(&self.env, &value).ok()),
)?
}
return Ok(result.into_unknown());
Ok(result.into_unknown())
}
}