Skip to content

Commit eb6c845

Browse files
committed
Fix most clippy lints
1 parent c350114 commit eb6c845

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

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

Lines changed: 5 additions & 11 deletions
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
}

xtask/src/lib.rs

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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)