Skip to content

Commit b2d2359

Browse files
committed
fix clippy
1 parent 29f3beb commit b2d2359

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/raw/cstr.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,18 @@ impl std::hash::Hash for CStr {
122122
}
123123
}
124124

125-
impl PartialOrd for CStr {
126-
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
127-
self.as_str().partial_cmp(other.as_str())
128-
}
129-
}
130-
131125
impl Ord for CStr {
132126
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
133127
self.as_str().cmp(other.as_str())
134128
}
135129
}
136130

131+
impl PartialOrd for CStr {
132+
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
133+
Some(self.cmp(other))
134+
}
135+
}
136+
137137
impl std::fmt::Display for CStr {
138138
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
139139
self.as_str().fmt(f)
@@ -160,9 +160,9 @@ impl AsRef<str> for CStr {
160160
}
161161
}
162162

163-
impl<'a> Into<&'a str> for &'a CStr {
164-
fn into(self) -> &'a str {
165-
self.as_str()
163+
impl<'a> From<&'a CStr> for &'a str {
164+
fn from(value: &'a CStr) -> Self {
165+
value.as_str()
166166
}
167167
}
168168

@@ -287,9 +287,9 @@ impl AsRef<CStr> for CString {
287287
}
288288
}
289289

290-
impl Into<String> for CString {
291-
fn into(self) -> String {
292-
self.into_string()
290+
impl From<CString> for String {
291+
fn from(value: CString) -> Self {
292+
value.into_string()
293293
}
294294
}
295295

0 commit comments

Comments
 (0)