From 5ed93bd1bf056f1d2b8632502300d7488df4e9df Mon Sep 17 00:00:00 2001 From: Henrik Tjäder Date: Fri, 18 Feb 2022 19:38:48 +0100 Subject: Clippy with pedantic suggestions --- macros/src/lib.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'macros/src/lib.rs') diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 13b6a7c2..2b526017 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -20,7 +20,10 @@ mod tests; /// Attribute used to declare a RTIC application /// /// For user documentation see the [RTIC book](https://rtic.rs) - +/// +/// # Panics +/// +/// Should never panic, cargo feeds a path which is later converted to a string #[proc_macro_attribute] pub fn app(args: TokenStream, input: TokenStream) -> TokenStream { let mut settings = Settings::default(); @@ -61,7 +64,10 @@ pub fn app(args: TokenStream, input: TokenStream) -> TokenStream { #[cfg(feature = "debugprint")] println!("OUT_DIR\n{:#?}", out_str); - if !out_dir.exists() { + if out_dir.exists() { + #[cfg(feature = "debugprint")] + println!("\ntarget/ exists\n"); + } else { // Set out_dir to OUT_DIR out_dir = Path::new(&out_str); @@ -80,24 +86,19 @@ pub fn app(args: TokenStream, input: TokenStream) -> TokenStream { .to_str() .unwrap() .starts_with(target_triple_prefix) - //|| path.ends_with(&out_dir_root) { if let Some(out) = path.parent() { out_dir = out; #[cfg(feature = "debugprint")] println!("{:#?}\n", out_dir); break; - } else { - // If no parent, just use it - out_dir = path; - break; } + // If no parent, just use it + out_dir = path; + break; } } } - } else { - #[cfg(feature = "debugprint")] - println!("\ntarget/ exists\n"); } // Try to write the expanded code to disk -- cgit v1.2.3