Open
Description
What it does
missing_public_function_example
would flag on functions that are:
- Accessible from outside the crate
- Do not have any examples at all
- Or have examples but nothing with that function name (iffy about this one, it would probably just be a text search rather than actually trying to understand the code in the examples)
missing_private_function_example
would flag in the same cases except also for internal functions.
Maybe there could be a config option to ignore unstable
functions so this could be used in std
.
Don't look for a # Examples
header because a lot of times it isn't there or isn't needed.
Advantage
This will help identify functions that have no example of usage, inspired by rust-lang/rust#121213.
Drawbacks
Possible FNs if this tries to detect the function in the example by name, but the example doesn't actually resolve to this function.
Example
/// Use this when you want to order drinks at the foobar
pub fn foo(bar: i32) {}
Could be written as:
/// Use this when you want to order drinks at the foobar
///
/// ```
/// foo(10);
/// ```
pub fn foo(bar: i32) {}
<code>