From 95602a759d9190cad92279aa5929d30166f2255c Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 20 Mar 2015 17:15:27 +1300 Subject: Add trivial cast lints. This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ``` --- src/libstd/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libstd/lib.rs') diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 90eca6168f2..228b885b653 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -135,6 +135,8 @@ #![feature(no_std)] #![no_std] +#![allow(trivial_cast)] +#![allow(trivial_numeric_cast)] #![deny(missing_docs)] #[cfg(test)] extern crate test; -- cgit 1.4.1-3-g733a5 From e7122a5a09d06aedd1d27d14c3ac38c40b0a7425 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Tue, 24 Mar 2015 11:23:34 +1300 Subject: Change lint names to plurals --- src/libcollections/lib.rs | 4 ++-- src/libcore/cell.rs | 2 +- src/libcore/fmt/mod.rs | 6 +++--- src/libcore/fmt/num.rs | 2 +- src/libcore/hash/mod.rs | 2 +- src/libcore/mem.rs | 2 +- src/libcore/num/i16.rs | 2 +- src/libcore/num/i32.rs | 2 +- src/libcore/num/i64.rs | 2 +- src/libcore/num/i8.rs | 2 +- src/libcore/num/int_macros.rs | 2 +- src/libcore/num/isize.rs | 2 +- src/libcore/num/mod.rs | 2 +- src/libcore/num/u16.rs | 2 +- src/libcore/num/u32.rs | 2 +- src/libcore/num/u64.rs | 2 +- src/libcore/num/u8.rs | 2 +- src/libcore/num/uint_macros.rs | 2 +- src/libcore/num/usize.rs | 2 +- src/librand/distributions/range.rs | 2 +- src/librand/isaac.rs | 2 +- src/librustc/lib.rs | 4 ++-- src/librustc/lint/builtin.rs | 8 ++++---- src/librustc_lint/builtin.rs | 2 +- src/librustc_llvm/lib.rs | 4 ++-- src/librustc_trans/lib.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 8 ++++---- src/libserialize/json.rs | 4 ++-- src/libstd/lib.rs | 4 ++-- src/libsyntax/ext/quote.rs | 2 +- src/test/compile-fail/liveness-unused.rs | 2 +- src/test/compile-fail/object-safety-by-value-self.rs | 2 +- src/test/compile-fail/trivial_casts.rs | 4 ++-- src/test/run-pass/trivial_casts.rs | 2 +- 34 files changed, 49 insertions(+), 49 deletions(-) (limited to 'src/libstd/lib.rs') diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 0a61eeb6e1c..6a65c991c95 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -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)] diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index f5db3e63c7a..9e6dbce0325 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -715,7 +715,7 @@ impl UnsafeCell { #[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 } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index e00cdc9de88..aa0d0a1539a 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -834,7 +834,7 @@ impl Pointer for *const T { impl 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 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) } } diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index d01d240e5b5..56d2eabc095 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -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; diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index ccc1d32eab3..2feb2f8b1e3 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -183,7 +183,7 @@ mod impls { fn hash_slice(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) }) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 0bc41eb2c6e..1e6fb51a8a5 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -314,7 +314,7 @@ pub fn drop(_x: T) { } #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn transmute_copy(src: &T) -> U { // FIXME(#23542) Replace with type ascription. - #![allow(trivial_cast)] + #![allow(trivial_casts)] ptr::read(src as *const T as *const U) } diff --git a/src/libcore/num/i16.rs b/src/libcore/num/i16.rs index 1557434a28a..efafce3fdef 100644 --- a/src/libcore/num/i16.rs +++ b/src/libcore/num/i16.rs @@ -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 } diff --git a/src/libcore/num/i32.rs b/src/libcore/num/i32.rs index bdccab4cb9a..72b0236a8d2 100644 --- a/src/libcore/num/i32.rs +++ b/src/libcore/num/i32.rs @@ -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 } diff --git a/src/libcore/num/i64.rs b/src/libcore/num/i64.rs index d8f5aa6e548..a64a4febd5a 100644 --- a/src/libcore/num/i64.rs +++ b/src/libcore/num/i64.rs @@ -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 } diff --git a/src/libcore/num/i8.rs b/src/libcore/num/i8.rs index da2410a04cf..459814875ee 100644 --- a/src/libcore/num/i8.rs +++ b/src/libcore/num/i8.rs @@ -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 } diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 5f697e02a99..675f568a960 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -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) => ( diff --git a/src/libcore/num/isize.rs b/src/libcore/num/isize.rs index 838caa59e47..9af51a36748 100644 --- a/src/libcore/num/isize.rs +++ b/src/libcore/num/isize.rs @@ -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 } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 7686a990acc..0eec875afc3 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -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}; diff --git a/src/libcore/num/u16.rs b/src/libcore/num/u16.rs index 9d91bbc7f90..289c5dbd08e 100644 --- a/src/libcore/num/u16.rs +++ b/src/libcore/num/u16.rs @@ -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 } diff --git a/src/libcore/num/u32.rs b/src/libcore/num/u32.rs index 2d5f163e093..6d0b6b0e5ea 100644 --- a/src/libcore/num/u32.rs +++ b/src/libcore/num/u32.rs @@ -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 } diff --git a/src/libcore/num/u64.rs b/src/libcore/num/u64.rs index 26813aa281c..bf8747fdb6e 100644 --- a/src/libcore/num/u64.rs +++ b/src/libcore/num/u64.rs @@ -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 } diff --git a/src/libcore/num/u8.rs b/src/libcore/num/u8.rs index 7fb28f27d62..05199735d4a 100644 --- a/src/libcore/num/u8.rs +++ b/src/libcore/num/u8.rs @@ -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 } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 9f502e3ea43..c22f31cc57e 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -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) => ( diff --git a/src/libcore/num/usize.rs b/src/libcore/num/usize.rs index be5acaac92a..82dd3312782 100644 --- a/src/libcore/num/usize.rs +++ b/src/libcore/num/usize.rs @@ -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 } diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index 0001cb6e0ca..a682fa85841 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -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 diff --git a/src/librand/isaac.rs b/src/librand/isaac.rs index 673246fe30d..14bebe0cd91 100644 --- a/src/librand/isaac.rs +++ b/src/librand/isaac.rs @@ -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(); diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index dd5f3cccea5..e8af07e4381 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -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; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 4f56f2441dc..2cc47f258f0 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -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 ) } } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 395460aca9f..8b57a48f3ce 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -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; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 4d821df72a6..9d564fa56f5 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -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")] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index ef43b9c0de4..99a64156d66 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -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; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index c8c7fb046b1..47aafa2251d 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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>> { - #![allow(trivial_numeric_cast)] + #![allow(trivial_numeric_casts)] use std::num::Int; let rty = ty::node_id_to_type(ccx.tcx, id); diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 17c41448540..0d6ed91d529 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -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) } })+ diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 228b885b653..cca6bb747d4 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -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; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 1aceec310e1..a25a6451918 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -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)) } diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/compile-fail/liveness-unused.rs index addeba03ab8..0fee48a8c6c 100644 --- a/src/test/compile-fail/liveness-unused.rs +++ b/src/test/compile-fail/liveness-unused.rs @@ -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` diff --git a/src/test/compile-fail/object-safety-by-value-self.rs b/src/test/compile-fail/object-safety-by-value-self.rs index 3b0e5786f3d..5a8772d6142 100644 --- a/src/test/compile-fail/object-safety-by-value-self.rs +++ b/src/test/compile-fail/object-safety-by-value-self.rs @@ -12,7 +12,7 @@ #![feature(rustc_attrs)] #![allow(dead_code)] -#![allow(trivial_cast)] +#![allow(trivial_casts)] trait Bar { fn bar(self); diff --git a/src/test/compile-fail/trivial_casts.rs b/src/test/compile-fail/trivial_casts.rs index 05c7747d5b9..3119b865488 100644 --- a/src/test/compile-fail/trivial_casts.rs +++ b/src/test/compile-fail/trivial_casts.rs @@ -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) {} diff --git a/src/test/run-pass/trivial_casts.rs b/src/test/run-pass/trivial_casts.rs index 4b145f1079b..3da1ba0f045 100644 --- a/src/test/run-pass/trivial_casts.rs +++ b/src/test/run-pass/trivial_casts.rs @@ -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) {} -- cgit 1.4.1-3-g733a5