This commit is contained in:
@@ -12,7 +12,7 @@ use rustc::ty::{Ty, TypeFlags};
|
|||||||
use rustc::{declare_lint_pass, declare_tool_lint};
|
use rustc::{declare_lint_pass, declare_tool_lint};
|
||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
use rustc_typeck::hir_ty_to_ty;
|
use rustc_typeck::hir_ty_to_ty;
|
||||||
use syntax_pos::{Span, DUMMY_SP};
|
use syntax_pos::{InnerSpan, Span, DUMMY_SP};
|
||||||
|
|
||||||
use crate::utils::{in_constant, in_macro_or_desugar, is_copy, span_lint_and_then};
|
use crate::utils::{in_constant, in_macro_or_desugar, is_copy, span_lint_and_then};
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>, source: S
|
|||||||
}
|
}
|
||||||
match source {
|
match source {
|
||||||
Source::Item { .. } => {
|
Source::Item { .. } => {
|
||||||
let const_kw_span = span.from_inner_byte_pos(0, 5);
|
let const_kw_span = span.from_inner(InnerSpan::new(0, 5));
|
||||||
db.span_suggestion(
|
db.span_suggestion(
|
||||||
const_kw_span,
|
const_kw_span,
|
||||||
"make this a static item",
|
"make this a static item",
|
||||||
|
|||||||
@@ -1120,7 +1120,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Casts {
|
|||||||
if let ExprKind::Lit(ref lit) = ex.node {
|
if let ExprKind::Lit(ref lit) = ex.node {
|
||||||
use syntax::ast::{LitIntType, LitKind};
|
use syntax::ast::{LitIntType, LitKind};
|
||||||
if let LitKind::Int(n, _) = lit.node {
|
if let LitKind::Int(n, _) = lit.node {
|
||||||
if cast_to.is_fp() {
|
if cast_to.is_floating_point() {
|
||||||
let from_nbits = 128 - n.leading_zeros();
|
let from_nbits = 128 - n.leading_zeros();
|
||||||
let to_nbits = fp_ty_mantissa_nbits(cast_to);
|
let to_nbits = fp_ty_mantissa_nbits(cast_to);
|
||||||
if from_nbits != 0 && to_nbits != 0 && from_nbits <= to_nbits {
|
if from_nbits != 0 && to_nbits != 0 && from_nbits <= to_nbits {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use std::borrow::Cow;
|
|||||||
use syntax::ast::*;
|
use syntax::ast::*;
|
||||||
use syntax::parse::{parser, token};
|
use syntax::parse::{parser, token};
|
||||||
use syntax::tokenstream::TokenStream;
|
use syntax::tokenstream::TokenStream;
|
||||||
use syntax_pos::{symbol::Symbol, BytePos, Span};
|
use syntax_pos::{BytePos, Span};
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// **What it does:** This lint warns when you use `println!("")` to
|
/// **What it does:** This lint warns when you use `println!("")` to
|
||||||
@@ -418,7 +418,7 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &TokenStream, is_write: bool) -> (O
|
|||||||
match arg.position {
|
match arg.position {
|
||||||
ArgumentImplicitlyIs(_) | ArgumentIs(_) => {},
|
ArgumentImplicitlyIs(_) | ArgumentIs(_) => {},
|
||||||
ArgumentNamed(name) => {
|
ArgumentNamed(name) => {
|
||||||
if *p == Symbol::intern(name) {
|
if *p == name {
|
||||||
seen = true;
|
seen = true;
|
||||||
all_simple &= arg.format == SIMPLE;
|
all_simple &= arg.format == SIMPLE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user