diff options
| author | Kevin Butler <haqkrs@gmail.com> | 2014-04-08 02:30:08 +0100 |
|---|---|---|
| committer | Kevin Butler <haqkrs@gmail.com> | 2014-04-11 20:27:01 +0100 |
| commit | d1e20488a5d1258b1582caa2db77e5210b8bd28f (patch) | |
| tree | 1f2bd0e6c2fefa86deba85d0d6f7c7d2d38b29df /src/libstd/path/windows.rs | |
| parent | 65abf96fb6630d7ddbcdc3b39f599c02ecfc2f1e (diff) | |
| download | rust-d1e20488a5d1258b1582caa2db77e5210b8bd28f.tar.gz rust-d1e20488a5d1258b1582caa2db77e5210b8bd28f.zip | |
Parameterize contains_nul for BytesContainer.
Diffstat (limited to 'src/libstd/path/windows.rs')
| -rw-r--r-- | src/libstd/path/windows.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 57dae68b842..93d8d9e3eb4 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -306,14 +306,13 @@ impl GenericPathUnsafe for Path { impl GenericPath for Path { #[inline] fn new_opt<T: BytesContainer>(path: T) -> Option<Path> { - let s = path.container_as_str(); - match s { + match path.container_as_str() { None => None, - Some(s) => { - if contains_nul(s.as_bytes()) { + Some(ref s) => { + if contains_nul(s) { None } else { - Some(unsafe { GenericPathUnsafe::new_unchecked(s) }) + Some(unsafe { GenericPathUnsafe::new_unchecked(*s) }) } } } |
