Skip to content

Commit d2039d4

Browse files
committed
Clean up shell example
Makes clippy happy
1 parent f5bafa5 commit d2039d4

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

examples/shell.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@ impl Context {
250250
println!("Directory listing of {:?}", path);
251251
let dir = self.resolve_existing_directory(path)?;
252252
// tree_dir will close this directory, always
253-
self.tree_dir(dir)
253+
Self::tree_dir(dir)
254254
}
255255

256256
/// Print a recursive directory listing for the given open directory.
257257
///
258258
/// Will close the given directory.
259-
fn tree_dir<'a>(&'a self, dir: Directory<'a>) -> Result<(), Error> {
259+
fn tree_dir(dir: Directory) -> Result<(), Error> {
260260
let mut children = Vec::new();
261261
dir.iterate_dir(|entry| {
262262
println!(
@@ -272,17 +272,9 @@ impl Context {
272272
})?;
273273
for child in children {
274274
println!("Entering {}", child);
275-
let child_dir = match dir.open_dir(&child) {
276-
Ok(child_dir) => child_dir,
277-
Err(e) => {
278-
return Err(e);
279-
}
280-
};
281-
let result = self.tree_dir(child_dir);
275+
let child_dir = dir.open_dir(&child)?;
276+
Self::tree_dir(child_dir)?;
282277
println!("Returning from {}", child);
283-
if let Err(e) = result {
284-
return Err(e);
285-
}
286278
}
287279
Ok(())
288280
}

0 commit comments

Comments
 (0)