Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 63c622d

Browse files
committedJan 18, 2025·
Add PartialEq and PartialOrd impls for comparing String and &String
This makes such comparisons more robust against the availability of other impls.
1 parent ef538a4 commit 63c622d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
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))]

‎src/bootstrap/src/core/build_steps/clippy.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ pub fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Ve
7777
let rule = format!("{prefix}{v}");
7878
// Arguments added by bootstrap in LintConfig won't show up in the all_args list, so
7979
// put them at the end of the command line.
80-
let position = all_args.iter().position(|t| t == &rule || t == v).unwrap_or(usize::MAX);
80+
let position =
81+
all_args.iter().position(|t| t == rule.as_str() || t == v).unwrap_or(usize::MAX);
8182
result.push((position, rule));
8283
});
8384
}

0 commit comments

Comments
 (0)
Please sign in to comment.