diff options
author | 2022-01-23 18:32:03 +0000 | |
---|---|---|
committer | 2022-01-23 18:32:03 +0000 | |
commit | 08111803edae11ab0fa4d0f287a865f434f4c12c (patch) | |
tree | b00e66deef005f0fcc57e997bfd5c7ed8bc3857e | |
parent | c350114d8002d91bd71d08e7ad6ee2e960c2ed35 (diff) | |
parent | 000279dd5984e7f1de90c9225ddafdaea61ed0cb (diff) | |
download | cortex-m-08111803edae11ab0fa4d0f287a865f434f4c12c.tar.gz cortex-m-08111803edae11ab0fa4d0f287a865f434f4c12c.tar.zst cortex-m-08111803edae11ab0fa4d0f287a865f434f4c12c.zip |
Merge #415
415: Fix most clippy lints r=adamgreig a=newAM
This fixes all clippy lints that do not result in a user-visible change, and result in valid code for the 1.40 MSRV.
Co-authored-by: Alex Martens <alex@thinglab.org>
-rw-r--r-- | .github/bors.toml | 4 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 2 | ||||
-rw-r--r-- | .github/workflows/rt-ci.yml | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | cortex-m-rt/README.md | 2 | ||||
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 16 | ||||
-rw-r--r-- | cortex-m-rt/src/lib.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | xtask/src/lib.rs | 4 | ||||
-rw-r--r-- | xtask/src/main.rs | 4 |
10 files changed, 17 insertions, 23 deletions
diff --git a/.github/bors.toml b/.github/bors.toml index a398b4a..4402e95 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -3,9 +3,9 @@ delete_merged_branches = true required_approvals = 1 status = [ "ci-linux (stable)", - "ci-linux (1.40.0)", + "ci-linux (1.42.0)", "rt-ci-linux (stable)", - "rt-ci-linux (1.40.0)", + "rt-ci-linux (1.42.0)", "rt-ci-other-os (macOS-latest)", "rt-ci-other-os (windows-latest)", "rustfmt", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d65b0f..8caebd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: include: # Test MSRV - - rust: 1.40.0 + - rust: 1.42.0 # Test nightly but don't fail - rust: nightly diff --git a/.github/workflows/rt-ci.yml b/.github/workflows/rt-ci.yml index 0e48b6b..8b95612 100644 --- a/.github/workflows/rt-ci.yml +++ b/.github/workflows/rt-ci.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: # All generated code should be running on stable now - rust: [nightly, stable, 1.40.0] + rust: [nightly, stable, 1.42.0] include: # Nightly is only for reference and allowed to fail @@ -11,7 +11,7 @@ This project is developed and maintained by the [Cortex-M team][team]. ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.40 and up. It might compile with older versions but that may change in any new patch release. +This crate is guaranteed to compile on stable Rust 1.42 and up. It might compile with older versions but that may change in any new patch release. ## License diff --git a/cortex-m-rt/README.md b/cortex-m-rt/README.md index 9857720..34b0f17 100644 --- a/cortex-m-rt/README.md +++ b/cortex-m-rt/README.md @@ -11,7 +11,7 @@ This project is developed and maintained by the [Cortex-M team][team]. # Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.40.0 and up. It *might* +This crate is guaranteed to compile on stable Rust 1.42.0 and up. It *might* compile with older versions but that may change in any new patch release. # License diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs index 817e9a1..24f3fa1 100644 --- a/cortex-m-rt/macros/src/lib.rs +++ b/cortex-m-rt/macros/src/lib.rs @@ -28,10 +28,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { && f.sig.variadic.is_none() && match f.sig.output { ReturnType::Default => false, - ReturnType::Type(_, ref ty) => match **ty { - Type::Never(_) => true, - _ => false, - }, + ReturnType::Type(_, ref ty) => matches!(**ty, Type::Never(_)), }; if !valid_signature { @@ -159,7 +156,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream { Exception::DefaultHandler | Exception::HardFault | Exception::NonMaskableInt => { // These are unsafe to define. let name = if exn == Exception::DefaultHandler { - format!("`DefaultHandler`") + "`DefaultHandler`".to_string() } else { format!("`{:?}` handler", exn) }; @@ -252,10 +249,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream { && f.sig.variadic.is_none() && match f.sig.output { ReturnType::Default => false, - ReturnType::Type(_, ref ty) => match **ty { - Type::Never(_) => true, - _ => false, - }, + ReturnType::Type(_, ref ty) => matches!(**ty, Type::Never(_)), }; if !valid_signature { @@ -557,7 +551,7 @@ fn extract_static_muts( let mut seen = HashSet::new(); let mut statics = vec![]; let mut stmts = vec![]; - while let Some(stmt) = istmts.next() { + for stmt in istmts.by_ref() { match stmt { Stmt::Item(Item::Static(var)) => { if var.mutability.is_some() { @@ -622,7 +616,7 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result< 'o: for attr in attrs { for val in whitelist { - if eq(&attr, &val) { + if eq(attr, val) { continue 'o; } } diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index 8003326..752d3d7 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -418,7 +418,7 @@ //! //! # Minimum Supported Rust Version (MSRV) //! -//! The MSRV of this release is Rust 1.40.0. +//! The MSRV of this release is Rust 1.42.0. // # Developer notes // @@ -52,7 +52,7 @@ //! //! # Minimum Supported Rust Version (MSRV) //! -//! This crate is guaranteed to compile on stable Rust 1.40 and up. It *might* +//! This crate is guaranteed to compile on stable Rust 1.42 and up. It *might* //! compile with older versions but that may change in any new patch release. #![cfg_attr(feature = "inline-asm", feature(asm))] diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index ddbb88b..f6a57b3 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs @@ -232,7 +232,7 @@ pub fn check_host_side() { { let a = VectActive::from(19).unwrap(); let b = VectActive::from(20).unwrap(); - assert_eq!(a < b, true); + assert!(a < b); } // check TryFrom @@ -240,7 +240,7 @@ pub fn check_host_side() { use core::convert::TryInto; use std::convert::TryFrom; - let lts: LocalTimestampOptions = (16 as u8).try_into().unwrap(); + let lts: LocalTimestampOptions = (16_u8).try_into().unwrap(); assert_eq!(lts, LocalTimestampOptions::EnabledDiv16); assert!(LocalTimestampOptions::try_from(42).is_err()); diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3e4b394..26dce31 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -2,8 +2,8 @@ use std::{env, process}; use xtask::{assemble_blobs, check_blobs, check_host_side}; fn main() { - let subcommand = env::args().skip(1).next(); - match subcommand.as_ref().map(|s| &**s) { + let subcommand = env::args().nth(1); + match subcommand.as_deref() { Some("assemble") => assemble_blobs(), Some("check-blobs") => check_blobs(), Some("check-host-side") => check_host_side(), |