Repository: mgeisler/textwrap (language: rust)

Issue:
Update examples to the 2018 edition
2018 edition edition is already out, it would good to update the examples in README to 2018 edition. I checked that the last release was also around 2018.


Discussion / hints:
Yes, I agree! I would be happy to update the examples.

Fix patch:
diff --git a/README.md b/README.md
index 7961dabf..d671a98d 100644
--- a/README.md
+++ b/README.md
@@ -13,17 +13,12 @@ the [Python textwrap module][py-textwrap].
 
 ## Usage
 
-Add this to your `Cargo.toml`:
+To use `textwrap`, add this to your `Cargo.toml` file:
 ```toml
 [dependencies]
 textwrap = "0.11"
 ```
 
-and this to your crate root:
-```rust
-extern crate textwrap;
-```
-
 If you would like to have automatic hyphenation, specify the
 dependency as:
 ```toml
@@ -47,12 +42,9 @@ textwrap = { version = "0.11", features = ["terminal_size"] }
 
 Word wrapping single strings is easy using the `fill` function:
 ```rust
-extern crate textwrap;
-use textwrap::fill;
-
 fn main() {
     let text = "textwrap: a small library for wrapping text.";
-    println!("{}", fill(text, 18));
+    println!("{}", textwrap::fill(text, 18));
 }
 ```
 The output is
@@ -66,9 +58,6 @@ With the `hyphenation` feature, you can get automatic hyphenation
 for [about 70 languages][patterns]. Your program must load and
 configure the hyphenation patterns to use:
 ```rust
-extern crate hyphenation;
-extern crate textwrap;
-
 use hyphenation::{Language, Load, Standard};
 use textwrap::Wrapper;
 
@@ -197,6 +186,8 @@ latest stable version of Rust from now on.
 The `term_size` feature has been replaced by `terminal_size`. The API
 is unchanged, it is just the name of the Cargo feature that changed.
 
+* Fixed [#177][issue-177]: Update examples to the 2018 edition.
+
 ### Version 0.11.0 — December 9th, 2018
 
 Due to our dependencies bumping their minimum supported version of
@@ -350,4 +341,5 @@ Contributions will be accepted under the same license.
 [issue-129]: https://github.com/mgeisler/textwrap/issues/129
 [issue-141]: https://github.com/mgeisler/textwrap/issues/141
 [issue-151]: https://github.com/mgeisler/textwrap/issues/151
+[issue-177]: https://github.com/mgeisler/textwrap/issues/177
 [mit]: LICENSE
diff --git a/src/lib.rs b/src/lib.rs
index 66e5d3b9..70ddfdaf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,8 +5,6 @@
 //! terminal. A quick example:
 //!
 //! ```no_run
-//! extern crate textwrap;
-//!
 //! fn main() {
 //!     let text = "textwrap: a small library for wrapping text.";
 //!     println!("{}", textwrap::fill(text, 18));
@@ -26,10 +24,6 @@
 //!
 //! ```no_run
 //! # #[cfg(feature = "hyphenation")]
-//! extern crate hyphenation;
-//! extern crate textwrap;
-//!
-//! # #[cfg(feature = "hyphenation")]
 //! use hyphenation::{Language, Load, Standard};
 //! use textwrap::Wrapper;
 //!
@@ -738,9 +732,6 @@ pub fn wrap_iter(s: &str, width: usize) -> IntoWrapIter<'_, HyphenSplitter> {
 
 #[cfg(test)]
 mod tests {
-    #[cfg(feature = "hyphenation")]
-    extern crate hyphenation;
-
     use super::*;
     #[cfg(feature = "hyphenation")]
     use hyphenation::{Language, Load, Standard};


Test patch: