Skip to content

Commit 19f5459

Browse files
jyn514Amanieu
authored andcommitted
Deny 2018 idiom lints (#1108)
This lint is allow by default, which is why this wasn't spotted earlier. It's denied by rust-lang/rust, so it's good to warn about it here so it can be fixed more quickly.
1 parent ec14619 commit 19f5459

File tree

13 files changed

+18
-18
lines changed

13 files changed

+18
-18
lines changed

crates/assert-instr-macro/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//! The procedural macro here is relatively simple, it simply appends a
88
//! `#[test]` function to the original token stream which asserts that the
99
//! function itself contains the relevant instruction.
10+
#![deny(rust_2018_idioms)]
1011

1112
extern crate proc_macro;
1213
extern crate proc_macro2;
@@ -162,7 +163,7 @@ struct Invoc {
162163
}
163164

164165
impl syn::parse::Parse for Invoc {
165-
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
166+
fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
166167
use syn::{ext::IdentExt, Token};
167168

168169
let mut instr = String::new();

crates/core_arch/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(improper_ctypes_definitions)]
33
#![allow(dead_code)]
44
#![allow(unused_features)]
5+
#![deny(rust_2018_idioms)]
56
#![feature(
67
asm,
78
const_fn,
@@ -69,9 +70,6 @@ extern crate std;
6970
#[cfg(test)]
7071
#[macro_use]
7172
extern crate std_detect;
72-
#[cfg(test)]
73-
extern crate stdarch_test;
74-
7573
#[path = "mod.rs"]
7674
mod core_arch;
7775

crates/core_arch/src/x86/avx512vpclmulqdq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::core_arch::x86::__m256i;
99
use crate::core_arch::x86::__m512i;
1010

1111
#[cfg(test)]
12-
use crate::stdarch_test::assert_instr;
12+
use stdarch_test::assert_instr;
1313

1414
#[allow(improper_ctypes)]
1515
extern "C" {

crates/core_arch/src/x86/fxsr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ mod tests {
8787
}
8888

8989
impl fmt::Debug for FxsaveArea {
90-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
90+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9191
write!(f, "[")?;
9292
for i in 0..self.data.len() {
9393
write!(f, "{}", self.data[i])?;

crates/core_arch/src/x86/pclmulqdq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use crate::core_arch::x86::__m128i;
99

1010
#[cfg(test)]
11-
use crate::stdarch_test::assert_instr;
11+
use stdarch_test::assert_instr;
1212

1313
#[allow(improper_ctypes)]
1414
extern "C" {

crates/core_arch/src/x86/xsave.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ mod tests {
196196
}
197197

198198
impl fmt::Debug for XsaveArea {
199-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
199+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
200200
write!(f, "[")?;
201201
for i in 0..self.data.len() {
202202
write!(f, "{}", self.data[i])?;

crates/core_arch/src/x86_64/fxsr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ mod tests {
8787
}
8888

8989
impl fmt::Debug for FxsaveArea {
90-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
90+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9191
write!(f, "[")?;
9292
for i in 0..self.data.len() {
9393
write!(f, "{}", self.data[i])?;

crates/core_arch/src/x86_64/xsave.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ mod tests {
164164
}
165165
166166
impl fmt::Debug for XsaveArea {
167-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
167+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
168168
write!(f, "[")?;
169169
for i in 0..self.data.len() {
170170
write!(f, "{}", self.data[i])?;

crates/simd-test-macro/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! This macro expands to a `#[test]` function which tests the local machine
44
//! for the appropriate cfg before calling the inner test function.
5+
#![deny(rust_2018_idioms)]
56

67
extern crate proc_macro;
78
extern crate proc_macro2;

crates/std_detect/src/detect/os/linux/cpuinfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl CpuInfo {
1717
})
1818
}
1919
/// Returns the value of the cpuinfo `field`.
20-
pub(crate) fn field(&self, field: &str) -> CpuInfoField {
20+
pub(crate) fn field(&self, field: &str) -> CpuInfoField<'_> {
2121
for l in self.raw.lines() {
2222
if l.trim().starts_with(field) {
2323
return CpuInfoField::new(l.split(": ").nth(1));

0 commit comments

Comments
 (0)