aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2019-11-28 22:17:33 +0000
committerGravatar GitHub <noreply@github.com> 2019-11-28 22:17:33 +0000
commitce538b28409ba15f42f1c0ff9b9e33d06f5e6dc8 (patch)
tree996de7759a2cd4fb8ff4170ce099d33886e2e8a6 /src/lib.rs
parent3607c6cfd5e7c1635064efbf37939420ea0b9d84 (diff)
parent3eebbfca17cde38d32fb3529f93ed61ae659ba1e (diff)
downloadcortex-m-ce538b28409ba15f42f1c0ff9b9e33d06f5e6dc8.tar.gz
cortex-m-ce538b28409ba15f42f1c0ff9b9e33d06f5e6dc8.tar.zst
cortex-m-ce538b28409ba15f42f1c0ff9b9e33d06f5e6dc8.zip
Merge #175
175: Enable the missing_inline_in_public_items clippy lint. r=jonas-schievink a=m-ou-se This adds `#![deny(clippy::missing_inline_in_public_items)]` to make sure all functions in this crate are marked `#[inline]`, unless they are explicitly marked with `#[allow(clippy::missing_inline_in_public_items)]`. Only three functions in this crate are not `#[inline]`: - `write_words` - `write_all` - `write_aligned` Additionally, the derived `Debug` impl's also have a non-inline implementations. This unfortunately means that the allow attribute also needs to added to any types deriving `Debug`. See also #171 and https://github.com/rust-embedded/cortex-m/pull/174#issuecomment-547304467. Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b4e1c96..481d84e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -35,6 +35,21 @@
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
+// This makes clippy warn about public functions which are not #[inline].
+//
+// Almost all functions in this crate result in trivial or even no assembly.
+// These functions should be #[inline].
+//
+// If you do add a function that's not supposed to be #[inline], you can add
+// #[allow(clippy::missing_inline_in_public_items)] in front of it to add an
+// exception to clippy's rules.
+//
+// This should be done in case of:
+// - A function containing non-trivial logic (such as itm::write_all); or
+// - A generated #[derive(Debug)] function (in which case the attribute needs
+// to be applied to the struct).
+#![deny(clippy::missing_inline_in_public_items)]
+
extern crate aligned;
extern crate bare_metal;
extern crate volatile_register;