mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Change lint names to plurals
This commit is contained in:
parent
dc206a91c8
commit
e7122a5a09
@ -24,8 +24,8 @@
|
||||
html_playground_url = "http://play.rust-lang.org/")]
|
||||
#![doc(test(no_crate_inject))]
|
||||
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
#![feature(alloc)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(box_patterns)]
|
||||
|
@ -715,7 +715,7 @@ impl<T> UnsafeCell<T> {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn get(&self) -> *mut T {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
&self.value as *const T as *mut T
|
||||
}
|
||||
|
||||
|
@ -834,7 +834,7 @@ impl<T> Pointer for *const T {
|
||||
impl<T> Pointer for *mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
Pointer::fmt(&(*self as *const T), f)
|
||||
}
|
||||
}
|
||||
@ -843,7 +843,7 @@ impl<T> Pointer for *mut T {
|
||||
impl<'a, T> Pointer for &'a T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
Pointer::fmt(&(*self as *const T), f)
|
||||
}
|
||||
}
|
||||
@ -852,7 +852,7 @@ impl<'a, T> Pointer for &'a T {
|
||||
impl<'a, T> Pointer for &'a mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
Pointer::fmt(&(&**self as *const T), f)
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// FIXME: #6220 Implement floating point formatting
|
||||
|
||||
#![allow(unsigned_negation)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
use fmt;
|
||||
use iter::IteratorExt;
|
||||
|
@ -183,7 +183,7 @@ mod impls {
|
||||
|
||||
fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
let newlen = data.len() * ::$ty::BYTES as usize;
|
||||
let ptr = data.as_ptr() as *const u8;
|
||||
state.write(unsafe { slice::from_raw_parts(ptr, newlen) })
|
||||
|
@ -314,7 +314,7 @@ pub fn drop<T>(_x: T) { }
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
ptr::read(src as *const T as *const U)
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i16")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
int_module! { i16, 16 }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i32")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
int_module! { i32, 32 }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i64")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
int_module! { i64, 64 }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "i8")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
int_module! { i8, 8 }
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![doc(hidden)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
macro_rules! int_module { ($T:ty, $bits:expr) => (
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "isize")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
int_module! { isize, 32 }
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![allow(missing_docs)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
use self::wrapping::{OverflowingOps, WrappingOps};
|
||||
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u16")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
uint_module! { u16, i16, 16 }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u32")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
uint_module! { u32, i32, 32 }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u64")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
uint_module! { u64, i64, 64 }
|
||||
|
@ -12,6 +12,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "u8")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
uint_module! { u8, i8, 8 }
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![doc(hidden)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
|
||||
|
||||
|
@ -16,6 +16,6 @@
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![doc(primitive = "usize")]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
uint_module! { usize, isize, ::isize::BITS }
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//! Generating numbers between two others.
|
||||
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
// this is surprisingly complicated to be both generic & correct
|
||||
|
||||
|
@ -447,7 +447,7 @@ impl Rng for Isaac64Rng {
|
||||
|
||||
#[inline]
|
||||
fn next_u64(&mut self) -> u64 {
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
if self.cnt == 0 {
|
||||
// make some more numbers
|
||||
self.isaac64();
|
||||
|
@ -47,8 +47,8 @@
|
||||
#![feature(into_cow)]
|
||||
#![cfg_attr(test, feature(test))]
|
||||
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
extern crate arena;
|
||||
extern crate flate;
|
||||
|
@ -101,13 +101,13 @@ declare_lint! {
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub TRIVIAL_CAST,
|
||||
pub TRIVIAL_CASTS,
|
||||
Warn,
|
||||
"detects trivial casts which could be removed"
|
||||
}
|
||||
|
||||
declare_lint! {
|
||||
pub TRIVIAL_NUMERIC_CAST,
|
||||
pub TRIVIAL_NUMERIC_CASTS,
|
||||
Warn,
|
||||
"detects trivial casts of numeric types which could be removed"
|
||||
}
|
||||
@ -133,8 +133,8 @@ impl LintPass for HardwiredLints {
|
||||
UNKNOWN_CRATE_TYPES,
|
||||
VARIANT_SIZE_DIFFERENCES,
|
||||
FAT_PTR_TRANSMUTES,
|
||||
TRIVIAL_CAST,
|
||||
TRIVIAL_NUMERIC_CAST
|
||||
TRIVIAL_CASTS,
|
||||
TRIVIAL_NUMERIC_CASTS
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1781,7 +1781,7 @@ impl LintPass for UnconditionalRecursion {
|
||||
fn check_fn(&mut self, cx: &Context, fn_kind: visit::FnKind, _: &ast::FnDecl,
|
||||
blk: &ast::Block, sp: Span, id: ast::NodeId) {
|
||||
// FIXME(#23542) Replace with type ascription.
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
|
||||
type F = for<'tcx> fn(&ty::ctxt<'tcx>,
|
||||
ast::NodeId, ast::NodeId, ast::Ident, ast::NodeId) -> bool;
|
||||
|
@ -14,8 +14,8 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
#![crate_name = "rustc_llvm"]
|
||||
#![unstable(feature = "rustc_private")]
|
||||
|
@ -43,8 +43,8 @@
|
||||
#![feature(convert)]
|
||||
#![feature(path_relative_from)]
|
||||
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
extern crate arena;
|
||||
extern crate flate;
|
||||
|
@ -1088,14 +1088,14 @@ fn check_cast<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, cast: &CastCheck<'tcx>) {
|
||||
if !ty::type_has_ty_infer(t_1) {
|
||||
if let Ok(()) = coercion::mk_assignty(fcx, e, t_e, t_1) {
|
||||
if ty::type_is_numeric(t_1) && ty::type_is_numeric(t_e) {
|
||||
fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_NUMERIC_CAST,
|
||||
fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_NUMERIC_CASTS,
|
||||
e.id,
|
||||
span,
|
||||
format!("trivial numeric cast: `{}` as `{}`",
|
||||
fcx.infcx().ty_to_string(t_e),
|
||||
fcx.infcx().ty_to_string(t_1)));
|
||||
} else {
|
||||
fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_CAST,
|
||||
fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_CASTS,
|
||||
e.id,
|
||||
span,
|
||||
format!("trivial cast: `{}` as `{}`",
|
||||
@ -4581,7 +4581,7 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
|
||||
ty: attr::IntType,
|
||||
disr: ty::Disr) -> bool {
|
||||
fn uint_in_range(ccx: &CrateCtxt, ty: ast::UintTy, disr: ty::Disr) -> bool {
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
|
||||
match ty {
|
||||
ast::TyU8 => disr as u8 as Disr == disr,
|
||||
@ -4611,7 +4611,7 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
|
||||
id: ast::NodeId,
|
||||
hint: attr::ReprAttr)
|
||||
-> Vec<Rc<ty::VariantInfo<'tcx>>> {
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
use std::num::Int;
|
||||
|
||||
let rty = ty::node_id_to_type(ccx.tcx, id);
|
||||
|
@ -2430,7 +2430,7 @@ macro_rules! to_json_impl_i64 {
|
||||
($($t:ty), +) => (
|
||||
$(impl ToJson for $t {
|
||||
fn to_json(&self) -> Json {
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
Json::I64(*self as i64)
|
||||
}
|
||||
})+
|
||||
@ -2443,7 +2443,7 @@ macro_rules! to_json_impl_u64 {
|
||||
($($t:ty), +) => (
|
||||
$(impl ToJson for $t {
|
||||
fn to_json(&self) -> Json {
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
Json::U64(*self as u64)
|
||||
}
|
||||
})+
|
||||
|
@ -135,8 +135,8 @@
|
||||
#![feature(no_std)]
|
||||
#![no_std]
|
||||
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(test)] extern crate test;
|
||||
|
@ -262,7 +262,7 @@ pub mod rt {
|
||||
(unsigned, $t:ty, $tag:expr) => (
|
||||
impl ToSource for $t {
|
||||
fn to_source(&self) -> String {
|
||||
#![allow(trivial_numeric_cast)]
|
||||
#![allow(trivial_numeric_casts)]
|
||||
let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag));
|
||||
pprust::lit_to_string(&dummy_spanned(lit))
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#![deny(unused_variables)]
|
||||
#![deny(unused_assignments)]
|
||||
#![allow(dead_code, non_camel_case_types, trivial_numeric_cast)]
|
||||
#![allow(dead_code, non_camel_case_types, trivial_numeric_casts)]
|
||||
|
||||
fn f1(x: isize) {
|
||||
//~^ ERROR unused variable: `x`
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(trivial_cast)]
|
||||
#![allow(trivial_casts)]
|
||||
|
||||
trait Bar {
|
||||
fn bar(self);
|
||||
|
@ -8,10 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Test the trivial_cast and trivial_numeric_cast lints. For each error we also
|
||||
// Test the trivial_casts and trivial_numeric_casts lints. For each error we also
|
||||
// check that the cast can be done using just coercion.
|
||||
|
||||
#![deny(trivial_cast, trivial_numeric_cast)]
|
||||
#![deny(trivial_casts, trivial_numeric_casts)]
|
||||
|
||||
trait Foo {
|
||||
fn foo(&self) {}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// Test that all coercions can actually be done using casts (modulo the lints).
|
||||
|
||||
#![allow(trivial_cast, trivial_numeric_cast)]
|
||||
#![allow(trivial_casts, trivial_numeric_casts)]
|
||||
|
||||
trait Foo {
|
||||
fn foo(&self) {}
|
||||
|
Loading…
Reference in New Issue
Block a user