diff --git a/booksrc/tutorial10.md b/booksrc/tutorial10.md index 7feaf6e..eb92ff2 100644 --- a/booksrc/tutorial10.md +++ b/booksrc/tutorial10.md @@ -17,8 +17,7 @@ Also a nice `match` on `ChainError.kind()` is now possible, which returns `&T `&Func1ErrorKind` here. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial10.rs:2:}} +{{#include ../examples/tutorial10.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial11.md b/booksrc/tutorial11.md index c679792..610051b 100644 --- a/booksrc/tutorial11.md +++ b/booksrc/tutorial11.md @@ -25,8 +25,7 @@ Also noteworthy is [custom_error](https://crates.io/crates/custom_error) to defi which can then be used with `chainerror`. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial11.rs:2:}} +{{#include ../examples/tutorial11.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial12.md b/booksrc/tutorial12.md index 6373ca0..81ab142 100644 --- a/booksrc/tutorial12.md +++ b/booksrc/tutorial12.md @@ -3,8 +3,7 @@ Because ChainError implements Deref to &T, we can also match on `*e` instead of `e.kind()` or call a function with `&e` ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial12.rs:2:}} +{{#include ../examples/tutorial12.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial2.md b/booksrc/tutorial2.md index 86e2726..4629605 100644 --- a/booksrc/tutorial2.md +++ b/booksrc/tutorial2.md @@ -6,8 +6,7 @@ the `String` errors are now chained together. Press the play button in the upper right corner and see the nice debug output. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial2.rs:2:}} +{{#include ../examples/tutorial2.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial3.md b/booksrc/tutorial3.md index b86e0ad..0abf07c 100644 --- a/booksrc/tutorial3.md +++ b/booksrc/tutorial3.md @@ -3,8 +3,7 @@ Now let's get more rust idiomatic by using `.map_err()`. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial3.rs:2:}} +{{#include ../examples/tutorial3.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial4.md b/booksrc/tutorial4.md index 95a6fab..70331c0 100644 --- a/booksrc/tutorial4.md +++ b/booksrc/tutorial4.md @@ -9,8 +9,7 @@ more debug strings. `mstrerror!()` even understands `format!()` syntax like `println!()`. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial4.rs:2:}} +{{#include ../examples/tutorial4.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial5.md b/booksrc/tutorial5.md index d98f09e..5595220 100644 --- a/booksrc/tutorial5.md +++ b/booksrc/tutorial5.md @@ -4,8 +4,7 @@ Sometimes you want to inspect the `source()` of an `Error`. `chainerror` implements `std::error::Error::source()`, so you can get the cause of an error. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial5.rs:2:}} +{{#include ../examples/tutorial5.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial6.md b/booksrc/tutorial6.md index 8154874..1d4a64e 100644 --- a/booksrc/tutorial6.md +++ b/booksrc/tutorial6.md @@ -11,8 +11,7 @@ pub fn downcast_mut(&mut self) -> Option<&mut T> This is how it looks like, when using those: ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial6.rs:2:}} +{{#include ../examples/tutorial6.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial7.md b/booksrc/tutorial7.md index 4ddd17f..cf65d04 100644 --- a/booksrc/tutorial7.md +++ b/booksrc/tutorial7.md @@ -27,8 +27,7 @@ or to use `.root_cause()`, which of course can be of any type implementing `std: ~~~ ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial7.rs:2:}} +{{#include ../examples/tutorial7.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial8.md b/booksrc/tutorial8.md index ce123e1..ed03342 100644 --- a/booksrc/tutorial8.md +++ b/booksrc/tutorial8.md @@ -23,8 +23,7 @@ as a shortcut to hiding the `ChainError` implementation detail. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial8.rs:2:}} +{{#include ../examples/tutorial8.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}} diff --git a/booksrc/tutorial9.md b/booksrc/tutorial9.md index e9107ca..df2e292 100644 --- a/booksrc/tutorial9.md +++ b/booksrc/tutorial9.md @@ -25,8 +25,7 @@ but this is not valid rust code, so we end up doing it the hard way. In the next chapter, we will see, how to solve this more elegantly. ~~~rust -use crate::chainerror::*; -{{#include ../examples/tutorial9.rs:2:}} +{{#include ../examples/tutorial9.rs}} # #[allow(dead_code)] # mod chainerror { {{#includecomment ../src/lib.rs}}