diff options
| author | bors <bors@rust-lang.org> | 2016-02-26 11:36:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-02-26 11:36:35 +0000 |
| commit | ee8b257d2e8a5b396ca8e8843756a1d662c8a550 (patch) | |
| tree | 0dfadb3c34406724a5ea82b7a6a30553760f2c9d /src/libstd | |
| parent | 09130044ce7429beb95742afa7fd371960dbe607 (diff) | |
| parent | 3c9a26853cca8783892d5b2373e9de63b5f488b5 (diff) | |
| download | rust-ee8b257d2e8a5b396ca8e8843756a1d662c8a550.tar.gz rust-ee8b257d2e8a5b396ca8e8843756a1d662c8a550.zip | |
Auto merge of #31911 - Manishearth:rollup, r=Manishearth
- Successful merges: #31878, #31880, #31883, #31893, #31894, #31896, #31901, #31904 - Failed merges: #31897
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/env.rs | 7 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 9 | ||||
| -rw-r--r-- | src/libstd/path.rs | 9 |
3 files changed, 14 insertions, 11 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs index aa6a6d548b3..3a543a947b5 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -442,7 +442,7 @@ impl Error for JoinPathsError { /// /// match env::home_dir() { /// Some(ref p) => println!("{}", p.display()), -/// None => println!("Impossible to get your home dir!") +/// None => println!("Impossible to get your home dir!"), /// } /// ``` #[stable(feature = "env", since = "1.0.0")] @@ -482,8 +482,7 @@ pub fn temp_dir() -> PathBuf { os_imp::temp_dir() } -/// Returns the filesystem path to the current executable which is running but -/// with the executable name. +/// Returns the full filesystem path to the current running executable. /// /// The path returned is not necessarily a "real path" to the executable as /// there may be intermediate symlinks. @@ -492,7 +491,7 @@ pub fn temp_dir() -> PathBuf { /// /// Acquiring the path to the current executable is a platform-specific operation /// that can fail for a good number of reasons. Some errors can include, but not -/// be limited to filesystem operations failing or general syscall failures. +/// be limited to, filesystem operations failing or general syscall failures. /// /// # Examples /// diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 6bdfdcd364a..61334f30924 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1055,7 +1055,14 @@ pub trait Write { let mut output = Adaptor { inner: self, error: Ok(()) }; match fmt::write(&mut output, fmt) { Ok(()) => Ok(()), - Err(..) => output.error + Err(..) => { + // check if the error came from the underlying `Write` or not + if output.error.is_err() { + output.error + } else { + Err(Error::new(ErrorKind::Other, "formatter error")) + } + } } } diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 35118bde96b..94967bfb96a 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -226,7 +226,7 @@ mod platform { } _ => (), } - } else if path.len() > 1 && path[1] == b':' { + } else if path.get(1) == Some(& b':') { // C: let c = path[0]; if c.is_ascii() && (c as char).is_alphabetic() { @@ -393,11 +393,8 @@ fn iter_after<A, I, J>(mut iter: I, mut prefix: J) -> Option<I> loop { let mut iter_next = iter.clone(); match (iter_next.next(), prefix.next()) { - (Some(x), Some(y)) => { - if x != y { - return None; - } - } + (Some(ref x), Some(ref y)) if x == y => (), + (Some(_), Some(_)) => return None, (Some(_), None) => return Some(iter), (None, None) => return Some(iter), (None, Some(_)) => return None, |
