Skip to content

Commit 941581d

Browse files
committed
Remove unnecessary boilerplate from doc examples
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 parent d89b7ef commit 941581d

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/lib.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
//! # Basic example
1616
//!
1717
//! ```no_run
18-
//!
1918
//! extern crate rexpect;
2019
//!
2120
//! use rexpect::spawn;
22-
//! use rexpect::error::*;
21+
//! use rexpect::error::Error;
2322
//!
24-
//! fn do_ftp() -> Result<()> {
23+
//! fn main() -> Result<(), Error> {
2524
//! let mut p = spawn("ftp speedtest.tele2.net", Some(2000))?;
2625
//! p.exp_regex("Name \\(.*\\):")?;
2726
//! p.send_line("anonymous")?;
@@ -36,11 +35,6 @@
3635
//! p.exp_eof()?;
3736
//! Ok(())
3837
//! }
39-
//!
40-
//!
41-
//! fn main() {
42-
//! do_ftp().unwrap_or_else(|e| panic!("ftp job failed with {}", e));
43-
//! }
4438
//! ```
4539
//!
4640
//! # Example with bash
@@ -55,10 +49,9 @@
5549
//! ```no_run
5650
//! extern crate rexpect;
5751
//! use rexpect::spawn_bash;
58-
//! use rexpect::error::*;
52+
//! use rexpect::error::Error;
5953
//!
60-
//!
61-
//! fn run() -> Result<()> {
54+
//! fn main() -> Result<(), Error> {
6255
//! let mut p = spawn_bash(Some(30_000))?;
6356
//! p.execute("ping 8.8.8.8", "bytes of data")?;
6457
//! p.send_control('z')?;
@@ -71,11 +64,6 @@
7164
//! p.exp_string("packet loss")?;
7265
//! Ok(())
7366
//! }
74-
//!
75-
//! fn main() {
76-
//! run().unwrap_or_else(|e| panic!("bash process failed with {}", e));
77-
//! }
78-
//!
7967
//! ```
8068
8169
pub mod error;

0 commit comments

Comments
 (0)