Skip to content

Commit f7320e2

Browse files
committed
Add PartialEq and PartialOrd impls for comparing String and &String
This makes such comparisons more robust against the availability of other impls.
1 parent d972108 commit f7320e2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/alloc/src/string.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2531,6 +2531,7 @@ macro_rules! impl_eq {
25312531

25322532
impl_eq! { String, str }
25332533
impl_eq! { String, &'a str }
2534+
impl_eq! { String, &String }
25342535
impl_eq! { &String, str }
25352536
#[cfg(not(no_global_oom_handling))]
25362537
impl_eq! { Cow<'a, str>, str }
@@ -2566,6 +2567,7 @@ macro_rules! impl_ord {
25662567
impl_ord! { String, str }
25672568
impl_ord! { String, &'a str }
25682569
impl_ord! { &String, str }
2570+
impl_ord! { String, &String }
25692571
#[cfg(not(no_global_oom_handling))]
25702572
impl_ord! { Cow<'a, str>, str }
25712573
#[cfg(not(no_global_oom_handling))]

0 commit comments

Comments
 (0)