aboutsummaryrefslogtreecommitdiff
path: root/macros/src/lib.rs
diff options
context:
space:
mode:
authorGravatar Henrik Tjäder <henrik@grepit.se> 2022-02-18 19:38:48 +0100
committerGravatar Henrik Tjäder <henrik@grepit.se> 2022-02-22 18:56:21 +0100
commit5ed93bd1bf056f1d2b8632502300d7488df4e9df (patch)
tree2e1bf40e2eaeeb4b58c996c1659c8a7429e2a518 /macros/src/lib.rs
parent57da1e0403510cafbdcf88e402b39ae6d3bf323e (diff)
downloadrtic-5ed93bd1bf056f1d2b8632502300d7488df4e9df.tar.gz
rtic-5ed93bd1bf056f1d2b8632502300d7488df4e9df.tar.zst
rtic-5ed93bd1bf056f1d2b8632502300d7488df4e9df.zip
Clippy with pedantic suggestions
Diffstat (limited to 'macros/src/lib.rs')
-rw-r--r--macros/src/lib.rs21
1 files changed, 11 insertions, 10 deletions
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