Replace all sort with unstable sort (#38427)

["When applicable, unstable sorting is preferred because it is generally
faster than stable sorting and it doesn’t allocate auxiliary
memory."](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.sort)

Binary also reduced by 1KB in Release.

Testing: No behaviour change as semantically all current usage does not
have any pair with `std::cmp::Ordering::Equal`.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-08-02 20:41:03 +08:00 committed by GitHub
parent 7c70d811a6
commit 58425f6ae2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View file

@ -814,7 +814,7 @@ fn load_userscripts(userscripts_directory: Option<&Path>) -> std::io::Result<Vec
let mut files = std::fs::read_dir(userscripts_directory)?
.map(|e| e.map(|entry| entry.path()))
.collect::<Result<Vec<_>, _>>()?;
files.sort();
files.sort_unstable();
for file in files {
userscripts.push(UserScript {
script: std::fs::read_to_string(&file)?,