clippy: Fix from_over_into warnings (#31946)

This commit is contained in:
eri 2024-03-30 12:30:14 +01:00 committed by GitHub
parent e3d6b66d5f
commit a7ad92d9a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 24 deletions

View file

@ -543,9 +543,9 @@ pub enum ProtoOrIfaceIndex {
Constructor(PrototypeList::Constructor), Constructor(PrototypeList::Constructor),
} }
impl Into<usize> for ProtoOrIfaceIndex { impl From<ProtoOrIfaceIndex> for usize {
fn into(self) -> usize { fn from(index: ProtoOrIfaceIndex) -> usize {
match self { match index {
ProtoOrIfaceIndex::ID(id) => id as usize, ProtoOrIfaceIndex::ID(id) => id as usize,
ProtoOrIfaceIndex::Constructor(constructor) => constructor as usize, ProtoOrIfaceIndex::Constructor(constructor) => constructor as usize,
} }

View file

@ -51,9 +51,9 @@ impl ByteString {
} }
} }
impl Into<Vec<u8>> for ByteString { impl From<ByteString> for Vec<u8> {
fn into(self) -> Vec<u8> { fn from(byte_string: ByteString) -> Vec<u8> {
self.0 byte_string.0
} }
} }
@ -640,21 +640,21 @@ impl From<DOMString> for String {
} }
} }
impl Into<Vec<u8>> for DOMString { impl From<DOMString> for Vec<u8> {
fn into(self) -> Vec<u8> { fn from(contents: DOMString) -> Vec<u8> {
self.0.into() contents.0.into()
} }
} }
impl<'a> Into<Cow<'a, str>> for DOMString { impl<'a> From<DOMString> for Cow<'a, str> {
fn into(self) -> Cow<'a, str> { fn from(contents: DOMString) -> Cow<'a, str> {
self.0.into() contents.0.into()
} }
} }
impl<'a> Into<CowRcStr<'a>> for DOMString { impl<'a> From<DOMString> for CowRcStr<'a> {
fn into(self) -> CowRcStr<'a> { fn from(contents: DOMString) -> CowRcStr<'a> {
self.0.into() contents.0.into()
} }
} }

View file

@ -3454,10 +3454,10 @@ impl UniqueId {
} }
} }
impl Into<LayoutNodeType> for NodeTypeId { impl From<NodeTypeId> for LayoutNodeType {
#[inline(always)] #[inline(always)]
fn into(self) -> LayoutNodeType { fn from(node_type: NodeTypeId) -> LayoutNodeType {
match self { match node_type {
NodeTypeId::Element(e) => LayoutNodeType::Element(e.into()), NodeTypeId::Element(e) => LayoutNodeType::Element(e.into()),
NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => LayoutNodeType::Text, NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => LayoutNodeType::Text,
x => unreachable!("Layout should not traverse nodes of type {:?}", x), x => unreachable!("Layout should not traverse nodes of type {:?}", x),
@ -3465,10 +3465,10 @@ impl Into<LayoutNodeType> for NodeTypeId {
} }
} }
impl Into<LayoutElementType> for ElementTypeId { impl From<ElementTypeId> for LayoutElementType {
#[inline(always)] #[inline(always)]
fn into(self) -> LayoutElementType { fn from(element_type: ElementTypeId) -> LayoutElementType {
match self { match element_type {
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement) => { ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement) => {
LayoutElementType::HTMLBodyElement LayoutElementType::HTMLBodyElement
}, },

View file

@ -99,9 +99,9 @@ impl XRSystem {
} }
} }
impl Into<SessionMode> for XRSessionMode { impl From<XRSessionMode> for SessionMode {
fn into(self) -> SessionMode { fn from(mode: XRSessionMode) -> SessionMode {
match self { match mode {
XRSessionMode::Immersive_vr => SessionMode::ImmersiveVR, XRSessionMode::Immersive_vr => SessionMode::ImmersiveVR,
XRSessionMode::Immersive_ar => SessionMode::ImmersiveAR, XRSessionMode::Immersive_ar => SessionMode::ImmersiveAR,
XRSessionMode::Inline => SessionMode::Inline, XRSessionMode::Inline => SessionMode::Inline,