mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
clippy: Fix suggestions in script
, libservo
, and servoshell
(#33453)
* fix clone on copy warning in servoshell Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Remove unecessary borrow in libservo Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Ignore too many arguments warning on create_constellation() Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * fix explicit auto-deref warning Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> * Autofix multiple clippy warnings in components/script Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com> --------- Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>
This commit is contained in:
parent
6a3cdc47ec
commit
ed6b1b5e6a
22 changed files with 44 additions and 42 deletions
|
@ -224,7 +224,7 @@ impl TryFrom<&GPUExtent3D> for wgt::Extent3d {
|
|||
}),
|
||||
GPUExtent3D::RangeEnforcedUnsignedLongSequence(ref v) => {
|
||||
// https://gpuweb.github.io/gpuweb/#abstract-opdef-validate-gpuextent3d-shape
|
||||
if v.len() < 1 || v.len() > 3 {
|
||||
if v.is_empty() || v.len() > 3 {
|
||||
Err(Error::Type(
|
||||
"GPUExtent3D size must be between 1 and 3 (inclusive)".to_string(),
|
||||
))
|
||||
|
@ -460,7 +460,7 @@ impl TryFrom<&GPUOrigin3D> for wgt::Origin3d {
|
|||
))
|
||||
} else {
|
||||
Ok(wgt::Origin3d {
|
||||
x: v.get(0).copied().unwrap_or(0),
|
||||
x: v.first().copied().unwrap_or(0),
|
||||
y: v.get(1).copied().unwrap_or(0),
|
||||
z: v.get(2).copied().unwrap_or(0),
|
||||
})
|
||||
|
@ -485,7 +485,7 @@ impl TryFrom<&GPUImageCopyTexture> for wgpu_com::ImageCopyTexture {
|
|||
origin: ic_texture
|
||||
.origin
|
||||
.as_ref()
|
||||
.map(|origin| wgt::Origin3d::try_from(origin))
|
||||
.map(wgt::Origin3d::try_from)
|
||||
.transpose()?
|
||||
.unwrap_or_default(),
|
||||
aspect: match ic_texture.aspect {
|
||||
|
@ -497,12 +497,12 @@ impl TryFrom<&GPUImageCopyTexture> for wgpu_com::ImageCopyTexture {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<Option<Cow<'a, str>>> for &GPUObjectDescriptorBase {
|
||||
fn into(self) -> Option<Cow<'a, str>> {
|
||||
if self.label.is_empty() {
|
||||
impl<'a> From<&GPUObjectDescriptorBase> for Option<Cow<'a, str>> {
|
||||
fn from(val: &GPUObjectDescriptorBase) -> Self {
|
||||
if val.label.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(Cow::Owned(self.label.to_string()))
|
||||
Some(Cow::Owned(val.label.to_string()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue