Replace rustc_semver with rustc_session::RustcVersion
This commit is contained in:
parent
cb806113e0
commit
b32a0176fa
13 changed files with 30 additions and 39 deletions
|
|
@ -4,8 +4,7 @@ use clippy_utils::diagnostics::span_lint_and_help;
|
|||
use rustc_ast::ast::{FloatTy, LitFloatType, LitKind};
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_session::{impl_lint_pass, RustcVersion};
|
||||
use rustc_span::symbol;
|
||||
use std::f64::consts as f64;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_hir::{Expr, ExprKind, HirId};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_session::{impl_lint_pass, RustcVersion};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::{ExpnKind, Span};
|
||||
|
||||
|
|
@ -65,18 +64,18 @@ impl IncompatibleMsrv {
|
|||
StabilityLevel::Stable {
|
||||
since: StableSince::Version(version),
|
||||
..
|
||||
} => Some(RustcVersion::new(
|
||||
version.major.into(),
|
||||
version.minor.into(),
|
||||
version.patch.into(),
|
||||
)),
|
||||
} => Some(version),
|
||||
_ => None,
|
||||
}) {
|
||||
version
|
||||
} else if let Some(parent_def_id) = tcx.opt_parent(def_id) {
|
||||
self.get_def_id_version(tcx, parent_def_id)
|
||||
} else {
|
||||
RustcVersion::new(1, 0, 0)
|
||||
RustcVersion {
|
||||
major: 1,
|
||||
minor: 0,
|
||||
patch: 0,
|
||||
}
|
||||
};
|
||||
self.is_above_msrv.insert(def_id, version);
|
||||
version
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::ExprKind::Assign;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_session::{impl_lint_pass, RustcVersion};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::{HirId, Path, PathSegment};
|
||||
use rustc_lint::{LateContext, LateLintPass, LintContext};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{sym, Span};
|
||||
|
|
@ -185,9 +184,7 @@ fn is_stable(cx: &LateContext<'_>, mut def_id: DefId, msrv: &Msrv) -> bool {
|
|||
} = stability.level
|
||||
{
|
||||
let stable = match since {
|
||||
StableSince::Version(v) => {
|
||||
msrv.meets(RustcVersion::new(v.major.into(), v.minor.into(), v.patch.into()))
|
||||
},
|
||||
StableSince::Version(v) => msrv.meets(v),
|
||||
StableSince::Current => msrv.current().is_none(),
|
||||
StableSince::Err => false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ use rustc_hir::intravisit::Visitor;
|
|||
use rustc_hir::{ExprKind, HirId, Item, MutTy, Mutability, Path, TyKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_semver::RustcVersion;
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
|
@ -92,7 +91,12 @@ pub struct LintWithoutLintPass {
|
|||
registered_lints: FxHashSet<Symbol>,
|
||||
}
|
||||
|
||||
impl_lint_pass!(LintWithoutLintPass => [DEFAULT_LINT, LINT_WITHOUT_LINT_PASS, INVALID_CLIPPY_VERSION_ATTRIBUTE, MISSING_CLIPPY_VERSION_ATTRIBUTE]);
|
||||
impl_lint_pass!(LintWithoutLintPass => [
|
||||
DEFAULT_LINT,
|
||||
LINT_WITHOUT_LINT_PASS,
|
||||
INVALID_CLIPPY_VERSION_ATTRIBUTE,
|
||||
MISSING_CLIPPY_VERSION_ATTRIBUTE,
|
||||
]);
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for LintWithoutLintPass {
|
||||
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
|
||||
|
|
@ -220,7 +224,7 @@ fn check_invalid_clippy_version_attribute(cx: &LateContext<'_>, item: &'_ Item<'
|
|||
return;
|
||||
}
|
||||
|
||||
if RustcVersion::parse(value.as_str()).is_err() {
|
||||
if rustc_attr::parse_version(value).is_none() {
|
||||
span_lint_and_help(
|
||||
cx,
|
||||
INVALID_CLIPPY_VERSION_ATTRIBUTE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue