mirror of https://github.com/astral-sh/ruff
fix: --explain reporting the wrong linter
Fixes a regression introduced in 4e4643aa5d.
We want the longest prefixes to be checked first so we of course
have to reverse the sorting when sorting by prefix length.
Fixes #2210.
This commit is contained in:
parent
bab8691132
commit
4f3b63edd4
|
|
@ -1,3 +1,4 @@
|
||||||
|
use std::cmp::Reverse;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use proc_macro2::{Ident, Span};
|
use proc_macro2::{Ident, Span};
|
||||||
|
|
@ -70,7 +71,7 @@ pub fn derive_impl(input: DeriveInput) -> syn::Result<proc_macro2::TokenStream>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed.sort_by_key(|(prefix, _)| prefix.len());
|
parsed.sort_by_key(|(prefix, _)| Reverse(prefix.len()));
|
||||||
|
|
||||||
let mut if_statements = quote!();
|
let mut if_statements = quote!();
|
||||||
let mut into_iter_match_arms = quote!();
|
let mut into_iter_match_arms = quote!();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue