1
Fork 0

rustc_lint: only query typeck_tables_of when a lint needs it.

This commit is contained in:
Eduard-Mihai Burtescu 2020-06-26 02:56:23 +03:00
parent 80bcbf521c
commit f5ce0e5fe9
100 changed files with 361 additions and 366 deletions

View file

@ -36,8 +36,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional {
if let ExprKind::Path(QPath::Resolved(_, ref path2)) = ident2.kind;
if let ExprKind::Path(QPath::Resolved(_, ref path3)) = second.kind;
if eq(&path1.segments[0], &path3.segments[0]) || eq(&path2.segments[0], &path3.segments[0]);
if cx.tables.expr_ty(ident1).is_integral();
if cx.tables.expr_ty(ident2).is_integral();
if cx.tables().expr_ty(ident1).is_integral();
if cx.tables().expr_ty(ident2).is_integral();
then {
if let BinOpKind::Lt = op.node {
if let BinOpKind::Add = op2.node {
@ -61,8 +61,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional {
if let ExprKind::Path(QPath::Resolved(_, ref path2)) = ident2.kind;
if let ExprKind::Path(QPath::Resolved(_, ref path3)) = first.kind;
if eq(&path1.segments[0], &path3.segments[0]) || eq(&path2.segments[0], &path3.segments[0]);
if cx.tables.expr_ty(ident1).is_integral();
if cx.tables.expr_ty(ident2).is_integral();
if cx.tables().expr_ty(ident1).is_integral();
if cx.tables().expr_ty(ident2).is_integral();
then {
if let BinOpKind::Gt = op.node {
if let BinOpKind::Add = op2.node {