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),
}
impl Into<usize> for ProtoOrIfaceIndex {
fn into(self) -> usize {
match self {
impl From<ProtoOrIfaceIndex> for usize {
fn from(index: ProtoOrIfaceIndex) -> usize {
match index {
ProtoOrIfaceIndex::ID(id) => id as usize,
ProtoOrIfaceIndex::Constructor(constructor) => constructor as usize,
}

View file

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

View file

@ -3454,10 +3454,10 @@ impl UniqueId {
}
}
impl Into<LayoutNodeType> for NodeTypeId {
impl From<NodeTypeId> for LayoutNodeType {
#[inline(always)]
fn into(self) -> LayoutNodeType {
match self {
fn from(node_type: NodeTypeId) -> LayoutNodeType {
match node_type {
NodeTypeId::Element(e) => LayoutNodeType::Element(e.into()),
NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => LayoutNodeType::Text,
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)]
fn into(self) -> LayoutElementType {
match self {
fn from(element_type: ElementTypeId) -> LayoutElementType {
match element_type {
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement) => {
LayoutElementType::HTMLBodyElement
},

View file

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