io::Result -> IOResult

This commit is contained in:
Benjamin Sago 2015-12-15 21:47:37 +00:00
parent c39a57294c
commit 95c0d63045
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
use std::io; use std::io::{self, Result as IOResult};
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::slice::Iter as SliceIter; use std::slice::Iter as SliceIter;
@ -32,7 +32,7 @@ impl Dir {
/// pointed to by the given path. Fails if the directory can't be read, or /// pointed to by the given path. Fails if the directory can't be read, or
/// isn't actually a directory, or if there's an IO error that occurs /// isn't actually a directory, or if there's an IO error that occurs
/// while scanning. /// while scanning.
pub fn read_dir(path: &Path, git: bool) -> io::Result<Dir> { pub fn read_dir(path: &Path, git: bool) -> IOResult<Dir> {
let reader = try!(fs::read_dir(path)); let reader = try!(fs::read_dir(path));
let contents = try!(reader.map(|e| e.map(|e| e.path())).collect()); let contents = try!(reader.map(|e| e.map(|e| e.path())).collect());

View File

@ -3,7 +3,7 @@
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::env::current_dir; use std::env::current_dir;
use std::fs; use std::fs;
use std::io; use std::io::Result as IOResult;
use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::path::{Component, Path, PathBuf}; use std::path::{Component, Path, PathBuf};
@ -89,7 +89,7 @@ impl<'dir> File<'dir> {
/// ///
/// This uses `symlink_metadata` instead of `metadata`, which doesn't /// This uses `symlink_metadata` instead of `metadata`, which doesn't
/// follow symbolic links. /// follow symbolic links.
pub fn from_path(path: &Path, parent: Option<&'dir Dir>) -> io::Result<File<'dir>> { pub fn from_path(path: &Path, parent: Option<&'dir Dir>) -> IOResult<File<'dir>> {
fs::symlink_metadata(path).map(|metadata| File::with_metadata(metadata, path, parent)) fs::symlink_metadata(path).map(|metadata| File::with_metadata(metadata, path, parent))
} }
@ -117,7 +117,7 @@ impl<'dir> File<'dir> {
/// ///
/// Returns an IO error upon failure, but this shouldn't be used to check /// Returns an IO error upon failure, but this shouldn't be used to check
/// if a `File` is a directory or not! For that, just use `is_directory()`. /// if a `File` is a directory or not! For that, just use `is_directory()`.
pub fn to_dir(&self, scan_for_git: bool) -> io::Result<Dir> { pub fn to_dir(&self, scan_for_git: bool) -> IOResult<Dir> {
Dir::read_dir(&*self.path, scan_for_git) Dir::read_dir(&*self.path, scan_for_git)
} }