account for doc visibility

This commit is contained in:
Andre Bogus 2019-10-02 17:19:30 +02:00
parent 737f0a6bb5
commit e3f143ff0a
10 changed files with 151 additions and 27 deletions

View file

@ -17,9 +17,59 @@ unsafe fn you_dont_see_me() {
unimplemented!();
}
fn main() {
you_dont_see_me();
destroy_the_planet();
let mut universe = ();
apocalypse(&mut universe);
mod private_mod {
pub unsafe fn only_crate_wide_accessible() {
unimplemented!();
}
pub unsafe fn republished() {
unimplemented!();
}
}
pub use private_mod::republished;
pub trait UnsafeTrait {
unsafe fn woefully_underdocumented(self);
/// # Safety
unsafe fn at_least_somewhat_documented(self);
}
pub struct Struct;
impl UnsafeTrait for Struct {
unsafe fn woefully_underdocumented(self) {
// all is well
}
unsafe fn at_least_somewhat_documented(self) {
// all is still well
}
}
impl Struct {
pub unsafe fn more_undocumented_unsafe() -> Self {
unimplemented!();
}
/// # Safety
pub unsafe fn somewhat_documented(&self) {
unimplemented!();
}
unsafe fn private(&self) {
unimplemented!();
}
}
#[allow(clippy::let_unit_value)]
fn main() {
unsafe {
you_dont_see_me();
destroy_the_planet();
let mut universe = ();
apocalypse(&mut universe);
private_mod::only_crate_wide_accessible();
}
}

View file

@ -8,5 +8,27 @@ LL | | }
|
= note: `-D clippy::missing-safety-doc` implied by `-D warnings`
error: aborting due to previous error
error: unsafe function's docs miss `# Safety` section
--> $DIR/doc_unsafe.rs:25:5
|
LL | / pub unsafe fn republished() {
LL | | unimplemented!();
LL | | }
| |_____^
error: unsafe function's docs miss `# Safety` section
--> $DIR/doc_unsafe.rs:33:5
|
LL | unsafe fn woefully_underdocumented(self);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unsafe function's docs miss `# Safety` section
--> $DIR/doc_unsafe.rs:52:5
|
LL | / pub unsafe fn more_undocumented_unsafe() -> Self {
LL | | unimplemented!();
LL | | }
| |_____^
error: aborting due to 4 previous errors

View file

@ -1,6 +1,6 @@
#![warn(clippy::all)]
#![allow(dead_code)]
#![allow(unused_unsafe)]
#![allow(unused_unsafe, clippy::missing_safety_doc)]
// TOO_MANY_ARGUMENTS
fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}

View file

@ -1,5 +1,5 @@
#![feature(const_fn)]
#![allow(dead_code)]
#![allow(dead_code, clippy::missing_safety_doc)]
#![warn(clippy::new_without_default)]
pub struct Foo;