Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 4395720

Browse files
committed
Document empty sections
1 parent ef877f2 commit 4395720

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ mod errors;
4444
Add a file for that module called `errors.rs` and put this inside:
4545

4646
```rust
47-
error_chain! {
48-
links { }
49-
50-
foreign_links { }
51-
52-
errors { }
53-
}
47+
error_chain! { }
5448
```
5549

5650
That's the setup. Now when writing modules for your crate,

src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,7 @@
8484
//! Add a file for that module called `errors.rs` and put this inside:
8585
//!
8686
//! ```ignore
87-
//! error_chain! {
88-
//! links { }
89-
//!
90-
//! foreign_links { }
91-
//!
92-
//! errors { }
93-
//! }
87+
//! error_chain! { }
9488
//! ```
9589
//!
9690
//! That's the setup. Now when writing modules for your crate,
@@ -166,6 +160,9 @@
166160
//! }
167161
//! ```
168162
//!
163+
//! Each section, `types`, `links`, `foreign_links`, and `errors` may
164+
//! be omitted if it is empty.
165+
//!
169166
//! This populates the module with a number of definitions,
170167
//! the most important of which are the `Error` type
171168
//! and the `ErrorKind` type. They look something like the

tests/tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ fn smoke_test_7() {
104104
}
105105
}
106106

107+
#[test]
108+
fn empty() {
109+
error_chain! { }
110+
}
111+
107112
#[cfg(test)]
108113
mod foreign_link_test {
109114

0 commit comments

Comments
 (0)