Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deny 2018 idiom lints #1108

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/assert-instr-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//! The procedural macro here is relatively simple, it simply appends a
//! `#[test]` function to the original token stream which asserts that the
//! function itself contains the relevant instruction.
#![deny(rust_2018_idioms)]

extern crate proc_macro;
extern crate proc_macro2;
Expand Down Expand Up @@ -177,7 +178,7 @@ struct Invoc {
}

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

let mut instr = String::new();
Expand Down
4 changes: 1 addition & 3 deletions crates/core_arch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(improper_ctypes_definitions)]
#![allow(dead_code)]
#![allow(unused_features)]
#![deny(rust_2018_idioms)]
#![feature(
asm,
const_fn,
Expand Down Expand Up @@ -68,9 +69,6 @@ extern crate std;
#[cfg(test)]
#[macro_use]
extern crate std_detect;
#[cfg(test)]
extern crate stdarch_test;

#[path = "mod.rs"]
mod core_arch;

Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86/avx512vpclmulqdq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::core_arch::x86::__m256i;
use crate::core_arch::x86::__m512i;

#[cfg(test)]
use crate::stdarch_test::assert_instr;
use stdarch_test::assert_instr;

#[allow(improper_ctypes)]
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86/fxsr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod tests {
}

impl fmt::Debug for FxsaveArea {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for i in 0..self.data.len() {
write!(f, "{}", self.data[i])?;
Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86/pclmulqdq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use crate::core_arch::x86::__m128i;

#[cfg(test)]
use crate::stdarch_test::assert_instr;
use stdarch_test::assert_instr;

#[allow(improper_ctypes)]
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86/xsave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ mod tests {
}

impl fmt::Debug for XsaveArea {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for i in 0..self.data.len() {
write!(f, "{}", self.data[i])?;
Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86_64/fxsr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod tests {
}

impl fmt::Debug for FxsaveArea {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for i in 0..self.data.len() {
write!(f, "{}", self.data[i])?;
Expand Down
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86_64/xsave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ mod tests {
}

impl fmt::Debug for XsaveArea {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[")?;
for i in 0..self.data.len() {
write!(f, "{}", self.data[i])?;
Expand Down
1 change: 1 addition & 0 deletions crates/simd-test-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//!
//! This macro expands to a `#[test]` function which tests the local machine
//! for the appropriate cfg before calling the inner test function.
#![deny(rust_2018_idioms)]

extern crate proc_macro;
extern crate proc_macro2;
Expand Down
2 changes: 1 addition & 1 deletion crates/std_detect/src/detect/os/linux/cpuinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl CpuInfo {
})
}
/// Returns the value of the cpuinfo `field`.
pub(crate) fn field(&self, field: &str) -> CpuInfoField {
pub(crate) fn field(&self, field: &str) -> CpuInfoField<'_> {
for l in self.raw.lines() {
if l.trim().starts_with(field) {
return CpuInfoField::new(l.split(": ").nth(1));
Expand Down
4 changes: 3 additions & 1 deletion crates/std_detect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@

#![unstable(feature = "stdsimd", issue = "27731")]
#![feature(const_fn, staged_api, stdsimd, doc_cfg, allow_internal_unstable)]
#![deny(rust_2018_idioms)]
#![allow(clippy::shadow_reuse)]
#![deny(clippy::missing_inline_in_public_items)]
#![cfg_attr(all(target_os = "freebsd", target_arch = "aarch64"), feature(asm))]
#![cfg_attr(test, allow(unused_imports))]
#![cfg_attr(feature = "std_detect_file_io", feature(vec_spare_capacity))]
#![no_std]

#[cfg_attr(feature = "rustc-dep-of-std", allow(unused_extern_crates))]
// rust-lang/rust#83888: removing `extern crate` gives an error that `vec_spare_capacity` is unknown
#[cfg_attr(feature = "std_detect_file_io", allow(unused_extern_crates))]
#[cfg(feature = "std_detect_file_io")]
extern crate alloc;

Expand Down
3 changes: 1 addition & 2 deletions crates/stdarch-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
//! output once globally and then provides the `assert` function which makes
//! assertions about the disassembly of a function.
#![feature(test)] // For black_box
#![deny(rust_2018_idioms)]
#![allow(clippy::missing_docs_in_private_items, clippy::print_stdout)]

extern crate assert_instr_macro;
extern crate cc;
#[macro_use]
extern crate lazy_static;
extern crate rustc_demangle;
extern crate simd_test_macro;
#[macro_use]
extern crate cfg_if;
Expand Down
7 changes: 3 additions & 4 deletions crates/stdarch-verify/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
extern crate proc_macro;
extern crate proc_macro2;
#![deny(rust_2018_idioms)]
#[macro_use]
extern crate quote;
#[macro_use]
Expand Down Expand Up @@ -357,7 +356,7 @@ fn find_instrs(attrs: &[syn::Attribute]) -> Vec<String> {
// TODO: should probably just reuse `Invoc` from the `assert-instr-macro`
// crate.
impl syn::parse::Parse for AssertInstr {
fn parse(content: syn::parse::ParseStream) -> syn::Result<Self> {
fn parse(content: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
let input;
parenthesized!(input in content);
let _ = input.parse::<syn::Meta>()?;
Expand Down Expand Up @@ -443,7 +442,7 @@ struct RustcArgsRequiredConst {
}

impl syn::parse::Parse for RustcArgsRequiredConst {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
let content;
parenthesized!(content in input);
let list =
Expand Down