mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 17:57:56 +00:00
Avoid Unstable Sort (#12455)
* dont use unstable sort * remove comment * add clippy rule
This commit is contained in:
@@ -1976,11 +1976,7 @@ pub mod env {
|
||||
data_len: u32,
|
||||
) -> Result<(), TrapReason> {
|
||||
fn has_duplicates<T: Ord>(items: &mut Vec<T>) -> bool {
|
||||
// # Warning
|
||||
//
|
||||
// Unstable sorts are non-deterministic across architectures. The usage here is OK
|
||||
// because we are rejecting duplicates which removes the non determinism.
|
||||
items.sort_unstable();
|
||||
items.sort();
|
||||
// Find any two consecutive equal elements.
|
||||
items.windows(2).any(|w| match &w {
|
||||
&[a, b] => a == b,
|
||||
|
||||
Reference in New Issue
Block a user