Skip to content

Commit 1141419

Browse files
chore: satisfy clippy::owned_cow
1 parent 6f4cd9a commit 1141419

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

moz-webgpu-cts/src/wpt/metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ where
870870
use std::borrow::Cow;
871871

872872
#[derive(Clone, Debug, Default, Eq, PartialEq)]
873-
struct TagsDisplay<'a>(Cow<'a, Vec<String>>);
873+
struct TagsDisplay<'a>(Cow<'a, [String]>);
874874

875875
impl Display for TagsDisplay<'_> {
876876
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
@@ -879,7 +879,7 @@ where
879879
}
880880
}
881881

882-
let tags_ref = tags.as_ref();
882+
let tags_ref = tags.as_deref();
883883
let tags_ref = tags_ref.map(Cow::Borrowed).map(TagsDisplay);
884884

885885
write_normalized(f, &indent, TAGS_IDENT, tags_ref)?;

moz-webgpu-cts/src/wpt/metadata/properties.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{
22
collections::BTreeMap,
33
fmt::{self, Debug, Display, Formatter},
44
num::NonZeroUsize,
5-
ops::{BitOr, BitOrAssign, Index, IndexMut},
5+
ops::{BitOr, BitOrAssign, Deref, Index, IndexMut},
66
};
77

88
use enum_map::EnumMap;
@@ -301,9 +301,12 @@ impl<T> ExpandedPropertyValue<T> {
301301
inner
302302
}
303303

304-
pub(crate) fn as_ref(&self) -> ExpandedPropertyValue<&T> {
304+
pub(crate) fn as_deref(&self) -> ExpandedPropertyValue<&<T as Deref>::Target>
305+
where
306+
T: Deref,
307+
{
305308
ExpandedPropertyValue::from_query(|platform, build_profile| {
306-
&self[(platform, build_profile)]
309+
&*self[(platform, build_profile)]
307310
})
308311
}
309312
}

0 commit comments

Comments
 (0)