]> git.lizzy.rs Git - rust.git/blob - src/docs/missing_errors_doc.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / missing_errors_doc.txt
1 ### What it does
2 Checks the doc comments of publicly visible functions that
3 return a `Result` type and warns if there is no `# Errors` section.
4
5 ### Why is this bad?
6 Documenting the type of errors that can be returned from a
7 function can help callers write code to handle the errors appropriately.
8
9 ### Examples
10 Since the following function returns a `Result` it has an `# Errors` section in
11 its doc comment:
12
13 ```
14 /// # Errors
15 ///
16 /// Will return `Err` if `filename` does not exist or the user does not have
17 /// permission to read it.
18 pub fn read(filename: String) -> io::Result<String> {
19     unimplemented!();
20 }
21 ```