diff options
| author | bors <bors@rust-lang.org> | 2015-04-16 03:22:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-16 03:22:21 +0000 |
| commit | 288809c8f35d9b37f2e4f5c3ac168f56dbc3bbc4 (patch) | |
| tree | 2606f4c9c39c215161feb41a74348d7e07d79c1c /src/libstd/path.rs | |
| parent | e40449e0d545561c73a9b9b324b5971b533a87b7 (diff) | |
| parent | c55ae1dc3094912c935fb95cf915841af0259305 (diff) | |
Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichton
r? @alexcrichton
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index b7160df6c92..cb78fc56bf2 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -218,7 +218,7 @@ mod platform { return Some(DeviceNS(u8_slice_as_os_str(slice))); } match parse_two_comps(path, is_sep_byte) { - Some((server, share)) if server.len() > 0 && share.len() > 0 => { + Some((server, share)) if !server.is_empty() && !share.is_empty() => { // \\server\share return Some(UNC(u8_slice_as_os_str(server), u8_slice_as_os_str(share))); @@ -401,7 +401,7 @@ unsafe fn u8_slice_as_os_str(s: &[u8]) -> &OsStr { /// Says whether the first byte after the prefix is a separator. fn has_physical_root(s: &[u8], prefix: Option<Prefix>) -> bool { let path = if let Some(p) = prefix { &s[p.len()..] } else { s }; - path.len() > 0 && is_sep_byte(path[0]) + !path.is_empty() && is_sep_byte(path[0]) } // basic workhorse for splitting stem and extension @@ -810,7 +810,7 @@ impl<'a> Iterator for Components<'a> { State::StartDir => { self.front = State::Body; if self.has_physical_root { - debug_assert!(self.path.len() > 0); + debug_assert!(!self.path.is_empty()); self.path = &self.path[1..]; return Some(Component::RootDir) } else if let Some(p) = self.prefix { @@ -818,7 +818,7 @@ impl<'a> Iterator for Components<'a> { return Some(Component::RootDir) } } else if self.include_cur_dir() { - debug_assert!(self.path.len() > 0); + debug_assert!(!self.path.is_empty()); self.path = &self.path[1..]; return Some(Component::CurDir) } @@ -1055,7 +1055,7 @@ impl PathBuf { }; let extension = extension.as_ref(); - if os_str_as_u8_slice(extension).len() > 0 { + if !os_str_as_u8_slice(extension).is_empty() { stem.push("."); stem.push(extension); } |
