1
Fork 0

Change lint names to plurals

This commit is contained in:
Nick Cameron 2015-03-24 11:23:34 +13:00
parent dc206a91c8
commit e7122a5a09
34 changed files with 49 additions and 49 deletions

View file

@ -24,8 +24,8 @@
html_playground_url = "http://play.rust-lang.org/")] html_playground_url = "http://play.rust-lang.org/")]
#![doc(test(no_crate_inject))] #![doc(test(no_crate_inject))]
#![allow(trivial_cast)] #![allow(trivial_casts)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
#![feature(alloc)] #![feature(alloc)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(box_patterns)] #![feature(box_patterns)]

View file

@ -715,7 +715,7 @@ impl<T> UnsafeCell<T> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self) -> *mut T { pub fn get(&self) -> *mut T {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
&self.value as *const T as *mut T &self.value as *const T as *mut T
} }

View file

@ -834,7 +834,7 @@ impl<T> Pointer for *const T {
impl<T> Pointer for *mut T { impl<T> Pointer for *mut T {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
Pointer::fmt(&(*self as *const T), f) Pointer::fmt(&(*self as *const T), f)
} }
} }
@ -843,7 +843,7 @@ impl<T> Pointer for *mut T {
impl<'a, T> Pointer for &'a T { impl<'a, T> Pointer for &'a T {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
Pointer::fmt(&(*self as *const T), f) 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 { impl<'a, T> Pointer for &'a mut T {
fn fmt(&self, f: &mut Formatter) -> Result { fn fmt(&self, f: &mut Formatter) -> Result {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
Pointer::fmt(&(&**self as *const T), f) Pointer::fmt(&(&**self as *const T), f)
} }
} }

View file

@ -13,7 +13,7 @@
// FIXME: #6220 Implement floating point formatting // FIXME: #6220 Implement floating point formatting
#![allow(unsigned_negation)] #![allow(unsigned_negation)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
use fmt; use fmt;
use iter::IteratorExt; use iter::IteratorExt;

View file

@ -183,7 +183,7 @@ mod impls {
fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) { fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
let newlen = data.len() * ::$ty::BYTES as usize; let newlen = data.len() * ::$ty::BYTES as usize;
let ptr = data.as_ptr() as *const u8; let ptr = data.as_ptr() as *const u8;
state.write(unsafe { slice::from_raw_parts(ptr, newlen) }) state.write(unsafe { slice::from_raw_parts(ptr, newlen) })

View file

@ -314,7 +314,7 @@ pub fn drop<T>(_x: T) { }
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn transmute_copy<T, U>(src: &T) -> U { pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
ptr::read(src as *const T as *const U) ptr::read(src as *const T as *const U)
} }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i16")] #![doc(primitive = "i16")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
int_module! { i16, 16 } int_module! { i16, 16 }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i32")] #![doc(primitive = "i32")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
int_module! { i32, 32 } int_module! { i32, 32 }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i64")] #![doc(primitive = "i64")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
int_module! { i64, 64 } int_module! { i64, 64 }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "i8")] #![doc(primitive = "i8")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
int_module! { i8, 8 } int_module! { i8, 8 }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
#![doc(hidden)] #![doc(hidden)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
macro_rules! int_module { ($T:ty, $bits:expr) => ( macro_rules! int_module { ($T:ty, $bits:expr) => (

View file

@ -16,7 +16,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "isize")] #![doc(primitive = "isize")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
#[cfg(target_pointer_width = "32")] #[cfg(target_pointer_width = "32")]
int_module! { isize, 32 } int_module! { isize, 32 }

View file

@ -14,7 +14,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
use self::wrapping::{OverflowingOps, WrappingOps}; use self::wrapping::{OverflowingOps, WrappingOps};

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u16")] #![doc(primitive = "u16")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
uint_module! { u16, i16, 16 } uint_module! { u16, i16, 16 }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u32")] #![doc(primitive = "u32")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
uint_module! { u32, i32, 32 } uint_module! { u32, i32, 32 }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u64")] #![doc(primitive = "u64")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
uint_module! { u64, i64, 64 } uint_module! { u64, i64, 64 }

View file

@ -12,6 +12,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "u8")] #![doc(primitive = "u8")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
uint_module! { u8, i8, 8 } uint_module! { u8, i8, 8 }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
#![doc(hidden)] #![doc(hidden)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => ( macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (

View file

@ -16,6 +16,6 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![doc(primitive = "usize")] #![doc(primitive = "usize")]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
uint_module! { usize, isize, ::isize::BITS } uint_module! { usize, isize, ::isize::BITS }

View file

@ -10,7 +10,7 @@
//! Generating numbers between two others. //! Generating numbers between two others.
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
// this is surprisingly complicated to be both generic & correct // this is surprisingly complicated to be both generic & correct

View file

@ -447,7 +447,7 @@ impl Rng for Isaac64Rng {
#[inline] #[inline]
fn next_u64(&mut self) -> u64 { fn next_u64(&mut self) -> u64 {
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
if self.cnt == 0 { if self.cnt == 0 {
// make some more numbers // make some more numbers
self.isaac64(); self.isaac64();

View file

@ -47,8 +47,8 @@
#![feature(into_cow)] #![feature(into_cow)]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![allow(trivial_cast)] #![allow(trivial_casts)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
extern crate arena; extern crate arena;
extern crate flate; extern crate flate;

View file

@ -101,13 +101,13 @@ declare_lint! {
} }
declare_lint! { declare_lint! {
pub TRIVIAL_CAST, pub TRIVIAL_CASTS,
Warn, Warn,
"detects trivial casts which could be removed" "detects trivial casts which could be removed"
} }
declare_lint! { declare_lint! {
pub TRIVIAL_NUMERIC_CAST, pub TRIVIAL_NUMERIC_CASTS,
Warn, Warn,
"detects trivial casts of numeric types which could be removed" "detects trivial casts of numeric types which could be removed"
} }
@ -133,8 +133,8 @@ impl LintPass for HardwiredLints {
UNKNOWN_CRATE_TYPES, UNKNOWN_CRATE_TYPES,
VARIANT_SIZE_DIFFERENCES, VARIANT_SIZE_DIFFERENCES,
FAT_PTR_TRANSMUTES, FAT_PTR_TRANSMUTES,
TRIVIAL_CAST, TRIVIAL_CASTS,
TRIVIAL_NUMERIC_CAST TRIVIAL_NUMERIC_CASTS
) )
} }
} }

View file

@ -1781,7 +1781,7 @@ impl LintPass for UnconditionalRecursion {
fn check_fn(&mut self, cx: &Context, fn_kind: visit::FnKind, _: &ast::FnDecl, fn check_fn(&mut self, cx: &Context, fn_kind: visit::FnKind, _: &ast::FnDecl,
blk: &ast::Block, sp: Span, id: ast::NodeId) { blk: &ast::Block, sp: Span, id: ast::NodeId) {
// FIXME(#23542) Replace with type ascription. // FIXME(#23542) Replace with type ascription.
#![allow(trivial_cast)] #![allow(trivial_casts)]
type F = for<'tcx> fn(&ty::ctxt<'tcx>, type F = for<'tcx> fn(&ty::ctxt<'tcx>,
ast::NodeId, ast::NodeId, ast::Ident, ast::NodeId) -> bool; ast::NodeId, ast::NodeId, ast::Ident, ast::NodeId) -> bool;

View file

@ -14,8 +14,8 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(trivial_cast)] #![allow(trivial_casts)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
#![crate_name = "rustc_llvm"] #![crate_name = "rustc_llvm"]
#![unstable(feature = "rustc_private")] #![unstable(feature = "rustc_private")]

View file

@ -43,8 +43,8 @@
#![feature(convert)] #![feature(convert)]
#![feature(path_relative_from)] #![feature(path_relative_from)]
#![allow(trivial_cast)] #![allow(trivial_casts)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
extern crate arena; extern crate arena;
extern crate flate; extern crate flate;

View file

@ -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 !ty::type_has_ty_infer(t_1) {
if let Ok(()) = coercion::mk_assignty(fcx, e, t_e, 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) { 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, e.id,
span, span,
format!("trivial numeric cast: `{}` as `{}`", format!("trivial numeric cast: `{}` as `{}`",
fcx.infcx().ty_to_string(t_e), fcx.infcx().ty_to_string(t_e),
fcx.infcx().ty_to_string(t_1))); fcx.infcx().ty_to_string(t_1)));
} else { } else {
fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_CAST, fcx.tcx().sess.add_lint(lint::builtin::TRIVIAL_CASTS,
e.id, e.id,
span, span,
format!("trivial cast: `{}` as `{}`", format!("trivial cast: `{}` as `{}`",
@ -4581,7 +4581,7 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
ty: attr::IntType, ty: attr::IntType,
disr: ty::Disr) -> bool { disr: ty::Disr) -> bool {
fn uint_in_range(ccx: &CrateCtxt, ty: ast::UintTy, 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 { match ty {
ast::TyU8 => disr as u8 as Disr == disr, 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, id: ast::NodeId,
hint: attr::ReprAttr) hint: attr::ReprAttr)
-> Vec<Rc<ty::VariantInfo<'tcx>>> { -> Vec<Rc<ty::VariantInfo<'tcx>>> {
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
use std::num::Int; use std::num::Int;
let rty = ty::node_id_to_type(ccx.tcx, id); let rty = ty::node_id_to_type(ccx.tcx, id);

View file

@ -2430,7 +2430,7 @@ macro_rules! to_json_impl_i64 {
($($t:ty), +) => ( ($($t:ty), +) => (
$(impl ToJson for $t { $(impl ToJson for $t {
fn to_json(&self) -> Json { fn to_json(&self) -> Json {
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
Json::I64(*self as i64) Json::I64(*self as i64)
} }
})+ })+
@ -2443,7 +2443,7 @@ macro_rules! to_json_impl_u64 {
($($t:ty), +) => ( ($($t:ty), +) => (
$(impl ToJson for $t { $(impl ToJson for $t {
fn to_json(&self) -> Json { fn to_json(&self) -> Json {
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
Json::U64(*self as u64) Json::U64(*self as u64)
} }
})+ })+

View file

@ -135,8 +135,8 @@
#![feature(no_std)] #![feature(no_std)]
#![no_std] #![no_std]
#![allow(trivial_cast)] #![allow(trivial_casts)]
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
#![deny(missing_docs)] #![deny(missing_docs)]
#[cfg(test)] extern crate test; #[cfg(test)] extern crate test;

View file

@ -262,7 +262,7 @@ pub mod rt {
(unsigned, $t:ty, $tag:expr) => ( (unsigned, $t:ty, $tag:expr) => (
impl ToSource for $t { impl ToSource for $t {
fn to_source(&self) -> String { fn to_source(&self) -> String {
#![allow(trivial_numeric_cast)] #![allow(trivial_numeric_casts)]
let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag)); let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag));
pprust::lit_to_string(&dummy_spanned(lit)) pprust::lit_to_string(&dummy_spanned(lit))
} }

View file

@ -10,7 +10,7 @@
#![deny(unused_variables)] #![deny(unused_variables)]
#![deny(unused_assignments)] #![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) { fn f1(x: isize) {
//~^ ERROR unused variable: `x` //~^ ERROR unused variable: `x`

View file

@ -12,7 +12,7 @@
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(trivial_cast)] #![allow(trivial_casts)]
trait Bar { trait Bar {
fn bar(self); fn bar(self);

View file

@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // 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. // check that the cast can be done using just coercion.
#![deny(trivial_cast, trivial_numeric_cast)] #![deny(trivial_casts, trivial_numeric_casts)]
trait Foo { trait Foo {
fn foo(&self) {} fn foo(&self) {}

View file

@ -10,7 +10,7 @@
// Test that all coercions can actually be done using casts (modulo the lints). // 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 { trait Foo {
fn foo(&self) {} fn foo(&self) {}