From 9c72aecdfcab9926729dfd9e909c1c86475f1048 Mon Sep 17 00:00:00 2001 From: Thomas Mulvaney Date: Fri, 20 Sep 2019 00:14:38 +0100 Subject: [PATCH] Remove error-chain from examples having only one error variant (#531) * Rmove error-chain from examples having only one error variant Remove error_chain from csv example 'Serde deserializes data into ...' Remove error_chain from toml example 'Parse TOML into your ...' * remove linebreak after main * remove line break --- src/encoding/complex/toml.md | 11 ++--------- src/encoding/csv/read.md | 10 +--------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/encoding/complex/toml.md b/src/encoding/complex/toml.md index fd7aa3d..4f0de96 100644 --- a/src/encoding/complex/toml.md +++ b/src/encoding/complex/toml.md @@ -34,12 +34,11 @@ fn main() -> Result<(), Error> { Parse TOML into your own structs using [Serde]. ```rust -# #[macro_use] -# extern crate error_chain; #[macro_use] extern crate serde_derive; extern crate toml; +use toml::de::Error; use std::collections::HashMap; #[derive(Deserialize)] @@ -54,14 +53,8 @@ struct Package { version: String, authors: Vec, } -# -# error_chain! { -# foreign_links { -# Toml(toml::de::Error); -# } -# } -fn main() -> Result<()> { +fn main() -> Result<(), Error> { let toml_content = r#" [package] name = "your_package" diff --git a/src/encoding/csv/read.md b/src/encoding/csv/read.md index ecff7d1..3820e79 100644 --- a/src/encoding/csv/read.md +++ b/src/encoding/csv/read.md @@ -36,17 +36,9 @@ Serde deserializes data into strongly type structures. See the ```rust extern crate csv; -# #[macro_use] -# extern crate error_chain; #[macro_use] extern crate serde_derive; -# error_chain! { -# foreign_links { -# Reader(csv::Error); -# } -# } -# #[derive(Deserialize)] struct Record { year: u16, @@ -55,7 +47,7 @@ struct Record { description: String, } -fn main() -> Result<()> { +fn main() -> Result<(), csv::Error> { let csv = "year,make,model,description 1948,Porsche,356,Luxury sports car 1967,Ford,Mustang fastback 1967,American car";