mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
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:
parent
9621cae218
commit
05f4fc0cde
14 changed files with 41 additions and 55 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
))));
|
||||
))))
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue