Implement the unused_macro_rules lint
This commit is contained in:
parent
3d43be3ad3
commit
0bd2232fe4
8 changed files with 139 additions and 27 deletions
|
@ -35,6 +35,9 @@ use crate::{LexicalScopeBinding, NameBinding, NameBindingKind, PrivacyError, Vis
|
|||
use crate::{ParentScope, PathResult, ResolutionError, Resolver, Scope, ScopeSet};
|
||||
use crate::{Segment, UseError};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
type Res = def::Res<ast::NodeId>;
|
||||
|
||||
/// A vector of spans and replacements, a message and applicability.
|
||||
|
@ -2663,3 +2666,14 @@ fn is_span_suitable_for_use_injection(s: Span) -> bool {
|
|||
// import or other generated ones
|
||||
!s.from_expansion()
|
||||
}
|
||||
|
||||
/// Convert the given number into the corresponding ordinal
|
||||
crate fn ordinalize(v: usize) -> String {
|
||||
let suffix = match ((11..=13).contains(&(v % 100)), v % 10) {
|
||||
(false, 1) => "st",
|
||||
(false, 2) => "nd",
|
||||
(false, 3) => "rd",
|
||||
_ => "th",
|
||||
};
|
||||
format!("{v}{suffix}")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue