We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8bac97 commit 8153cf0Copy full SHA for 8153cf0
oma-pm/src/matches.rs
@@ -240,22 +240,10 @@ impl<'a> PackagesMatcher<'a> {
240
241
// 确保数组第一个是 candidate version
242
if !self.filter_candidate {
243
- let candidate_list = res
244
- .iter()
245
- .enumerate()
246
- .filter_map(|(idx, pkg)| {
247
- if pkg.is_candidate_version(self.cache) {
248
- Some(idx)
249
- } else {
250
- None
251
- }
252
- })
253
- .collect::<Vec<_>>();
254
-
255
- for idx in candidate_list {
256
- let pkg = res.remove(idx);
257
- res.insert(0, pkg);
258
+ res.sort_by(|a, b| {
+ b.is_candidate_version(self.cache)
+ .cmp(&a.is_candidate_version(self.cache))
+ });
259
}
260
261
Ok(res)
0 commit comments