core: String equality should short-circuit on pointer equality
This commit is contained in:
parent
29d2df5f07
commit
54fcfde1cc
|
@ -96,6 +96,10 @@ pub fn str_debug_fmt(s: &WStr, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||
}
|
||||
|
||||
pub fn str_eq(left: &WStr, right: &WStr) -> bool {
|
||||
if std::ptr::eq(left, right) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let (bytes, wide) = match (left.units(), right.units()) {
|
||||
(Units::Bytes(a), Units::Bytes(b)) => return a == b,
|
||||
(Units::Wide(a), Units::Wide(b)) => return a == b,
|
||||
|
|
Loading…
Reference in New Issue