Skip to content

Commit da09c39

Browse files
authored
Fix or silence clippy warnings (#41)
* Run cargo fmt * Fix or silence clippy warnings
1 parent 5a1ddeb commit da09c39

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

atat/examples/cortex-m-rt.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ fn main() -> ! {
7575
serial.listen(Rxne);
7676

7777
let (tx, rx) = serial.split();
78-
let (mut client, ingress) = atat::new(tx, at_timer, atat::Config::new(atat::Mode::Timeout), None);
78+
let (mut client, ingress) =
79+
atat::new(tx, at_timer, atat::Config::new(atat::Mode::Timeout), None);
7980

8081
unsafe { INGRESS = Some(ingress) };
8182
unsafe { RX = Some(rx) };

atat/examples/rtfm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ const APP: () = {
7777
serial.listen(Rxne);
7878

7979
let (tx, rx) = serial.split();
80-
let (mut client, ingress) = atat::new(tx, timer, atat::Config::new(atat::Mode::Timeout), None);
80+
let (mut client, ingress) =
81+
atat::new(tx, timer, atat::Config::new(atat::Mode::Timeout), None);
8182

8283
ctx.spawn.at_loop().unwrap();
8384

atat/src/ingress_manager.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,10 @@ mod test {
736736
struct MyUrcMatcher {}
737737
impl UrcMatcher for MyUrcMatcher {
738738
type MaxLen = consts::U256;
739-
fn process(&mut self, buf: &mut String<consts::U256>) -> UrcMatcherResult<Self::MaxLen> {
739+
fn process(
740+
&mut self,
741+
buf: &mut String<consts::U256>,
742+
) -> UrcMatcherResult<Self::MaxLen> {
740743
if buf.starts_with("+match") {
741744
let data = buf.clone();
742745
buf.truncate(0);

atat_derive/src/helpers.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::proc_macro2::{Literal, TokenStream, TokenTree};
2-
use quote::quote;
32

43
use syn::{spanned::Spanned, Error, FieldsNamed, Ident, Result, Type};
54

@@ -35,7 +34,7 @@ pub fn get_name_ident_lit(tokens: &proc_macro2::TokenStream, needle: &str) -> Re
3534
for l in stream_from_tokens(tokens) {
3635
match l {
3736
TokenTree::Ident(i) => {
38-
if i.to_string() == needle {
37+
if i == needle {
3938
found = true;
4039
} else if found {
4140
return Ok(i.to_string());
@@ -65,7 +64,11 @@ pub fn get_name_ident_lit(tokens: &proc_macro2::TokenStream, needle: &str) -> Re
6564

6665
pub fn get_field_names(fields: Option<&FieldsNamed>) -> (Vec<Ident>, Vec<Type>, Vec<String>) {
6766
if let Some(fields) = fields {
68-
let (mut field_name_pos, mut field_type_pos): (Vec<(Ident, usize)>, Vec<(Type, usize)>) = {
67+
#[allow(clippy::type_complexity)] // TODO: Maybe refactor this?
68+
let (mut field_name_pos, mut field_type_pos): (
69+
Vec<(Ident, usize)>,
70+
Vec<(Type, usize)>,
71+
) = {
6972
(
7073
fields
7174
.named

atat_derive/src/resp.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub fn atat_resp(item: DeriveInput) -> TokenStream {
3333
}
3434
}
3535

36+
#[allow(clippy::cognitive_complexity)]
3637
fn generate_resp_output(
3738
name: &Ident,
3839
generics: &syn::Generics,

0 commit comments

Comments
 (0)