Skip to content

Commit 0811180

Browse files
bors[bot]newAM
andauthored
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 <[email protected]>
2 parents c350114 + 000279d commit 0811180

File tree

10 files changed

+17
-23
lines changed

10 files changed

+17
-23
lines changed

.github/bors.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ delete_merged_branches = true
33
required_approvals = 1
44
status = [
55
"ci-linux (stable)",
6-
"ci-linux (1.40.0)",
6+
"ci-linux (1.42.0)",
77
"rt-ci-linux (stable)",
8-
"rt-ci-linux (1.40.0)",
8+
"rt-ci-linux (1.42.0)",
99
"rt-ci-other-os (macOS-latest)",
1010
"rt-ci-other-os (windows-latest)",
1111
"rustfmt",

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
include:
1818
# Test MSRV
19-
- rust: 1.40.0
19+
- rust: 1.42.0
2020

2121
# Test nightly but don't fail
2222
- rust: nightly

.github/workflows/rt-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
# All generated code should be running on stable now
15-
rust: [nightly, stable, 1.40.0]
15+
rust: [nightly, stable, 1.42.0]
1616

1717
include:
1818
# Nightly is only for reference and allowed to fail

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This project is developed and maintained by the [Cortex-M team][team].
1111

1212
## Minimum Supported Rust Version (MSRV)
1313

14-
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.
14+
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.
1515

1616
## License
1717

cortex-m-rt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This project is developed and maintained by the [Cortex-M team][team].
1111

1212
# Minimum Supported Rust Version (MSRV)
1313

14-
This crate is guaranteed to compile on stable Rust 1.40.0 and up. It *might*
14+
This crate is guaranteed to compile on stable Rust 1.42.0 and up. It *might*
1515
compile with older versions but that may change in any new patch release.
1616

1717
# License

cortex-m-rt/macros/src/lib.rs

+5-11
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream {
2828
&& f.sig.variadic.is_none()
2929
&& match f.sig.output {
3030
ReturnType::Default => false,
31-
ReturnType::Type(_, ref ty) => match **ty {
32-
Type::Never(_) => true,
33-
_ => false,
34-
},
31+
ReturnType::Type(_, ref ty) => matches!(**ty, Type::Never(_)),
3532
};
3633

3734
if !valid_signature {
@@ -159,7 +156,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
159156
Exception::DefaultHandler | Exception::HardFault | Exception::NonMaskableInt => {
160157
// These are unsafe to define.
161158
let name = if exn == Exception::DefaultHandler {
162-
format!("`DefaultHandler`")
159+
"`DefaultHandler`".to_string()
163160
} else {
164161
format!("`{:?}` handler", exn)
165162
};
@@ -252,10 +249,7 @@ pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream {
252249
&& f.sig.variadic.is_none()
253250
&& match f.sig.output {
254251
ReturnType::Default => false,
255-
ReturnType::Type(_, ref ty) => match **ty {
256-
Type::Never(_) => true,
257-
_ => false,
258-
},
252+
ReturnType::Type(_, ref ty) => matches!(**ty, Type::Never(_)),
259253
};
260254

261255
if !valid_signature {
@@ -557,7 +551,7 @@ fn extract_static_muts(
557551
let mut seen = HashSet::new();
558552
let mut statics = vec![];
559553
let mut stmts = vec![];
560-
while let Some(stmt) = istmts.next() {
554+
for stmt in istmts.by_ref() {
561555
match stmt {
562556
Stmt::Item(Item::Static(var)) => {
563557
if var.mutability.is_some() {
@@ -622,7 +616,7 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
622616

623617
'o: for attr in attrs {
624618
for val in whitelist {
625-
if eq(&attr, &val) {
619+
if eq(attr, val) {
626620
continue 'o;
627621
}
628622
}

cortex-m-rt/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@
418418
//!
419419
//! # Minimum Supported Rust Version (MSRV)
420420
//!
421-
//! The MSRV of this release is Rust 1.40.0.
421+
//! The MSRV of this release is Rust 1.42.0.
422422
423423
// # Developer notes
424424
//

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//!
5353
//! # Minimum Supported Rust Version (MSRV)
5454
//!
55-
//! This crate is guaranteed to compile on stable Rust 1.40 and up. It *might*
55+
//! This crate is guaranteed to compile on stable Rust 1.42 and up. It *might*
5656
//! compile with older versions but that may change in any new patch release.
5757
5858
#![cfg_attr(feature = "inline-asm", feature(asm))]

xtask/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,15 @@ pub fn check_host_side() {
232232
{
233233
let a = VectActive::from(19).unwrap();
234234
let b = VectActive::from(20).unwrap();
235-
assert_eq!(a < b, true);
235+
assert!(a < b);
236236
}
237237

238238
// check TryFrom
239239
{
240240
use core::convert::TryInto;
241241
use std::convert::TryFrom;
242242

243-
let lts: LocalTimestampOptions = (16 as u8).try_into().unwrap();
243+
let lts: LocalTimestampOptions = (16_u8).try_into().unwrap();
244244
assert_eq!(lts, LocalTimestampOptions::EnabledDiv16);
245245

246246
assert!(LocalTimestampOptions::try_from(42).is_err());

xtask/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::{env, process};
22
use xtask::{assemble_blobs, check_blobs, check_host_side};
33

44
fn main() {
5-
let subcommand = env::args().skip(1).next();
6-
match subcommand.as_ref().map(|s| &**s) {
5+
let subcommand = env::args().nth(1);
6+
match subcommand.as_deref() {
77
Some("assemble") => assemble_blobs(),
88
Some("check-blobs") => check_blobs(),
99
Some("check-host-side") => check_host_side(),

0 commit comments

Comments
 (0)