diff options
| author | Miguel Ojeda <ojeda@kernel.org> | 2021-02-24 05:48:44 +0100 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2021-02-24 06:13:42 +0100 |
| commit | eefec8abda7cb8e8693aa876fbd1e21f2a6a5c2d (patch) | |
| tree | 967ee057ebe74460adc39e7853d4ed4a9e23c47e /src | |
| parent | fe1bf8e05c39bdcc73fc09e246b7209444e389bc (diff) | |
| download | rust-eefec8abda7cb8e8693aa876fbd1e21f2a6a5c2d.tar.gz rust-eefec8abda7cb8e8693aa876fbd1e21f2a6a5c2d.zip | |
library: Normalize safety-for-unsafe-block comments
Almost all safety comments are of the form `// SAFETY:`, so normalize the rest and fix a few of them that should have been a `/// # Safety` section instead. Furthermore, make `tidy` only allow the uppercase form. While currently `tidy` only checks `core`, it is a good idea to prevent `core` from drifting to non-uppercase comments, so that later we can start checking `alloc` etc. too. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/style.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 9f68c55ec97..75c43343023 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -289,7 +289,7 @@ pub fn check(path: &Path, bad: &mut bool) { suppressible_tidy_err!(err, skip_undocumented_unsafe, "undocumented unsafe"); } } - if line.contains("// SAFETY:") || line.contains("// Safety:") { + if line.contains("// SAFETY:") { last_safety_comment = true; } else if line.trim().starts_with("//") || line.trim().is_empty() { // keep previous value |
