diff options
| author | nham <hamann.nick@gmail.com> | 2014-08-06 02:02:50 -0400 |
|---|---|---|
| committer | nham <hamann.nick@gmail.com> | 2014-08-06 02:02:50 -0400 |
| commit | 3fb78e29f4ae9b3e5bb19bf5a740375e90b01ceb (patch) | |
| tree | b4dcb4ce0e5f25a5f92c5a99f44d6ade5243144a /src/libstd/path | |
| parent | dfdea3f116ea028b347ca5b73dc462a6d48d9940 (diff) | |
| download | rust-3fb78e29f4ae9b3e5bb19bf5a740375e90b01ceb.tar.gz rust-3fb78e29f4ae9b3e5bb19bf5a740375e90b01ceb.zip | |
Use byte literals in libstd
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 2 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index a22db7292fa..d290a5f8c63 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -351,7 +351,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { match self.filename() { None => None, Some(name) => Some({ - let dot = '.' as u8; + let dot = b'.'; match name.rposition_elem(&dot) { None | Some(0) => name, Some(1) if name == b".." => name, @@ -398,7 +398,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { match self.filename() { None => None, Some(name) => { - let dot = '.' as u8; + let dot = b'.'; match name.rposition_elem(&dot) { None | Some(0) => None, Some(1) if name == b".." => None, @@ -474,7 +474,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { assert!(!contains_nul(&extension)); let val = self.filename().and_then(|name| { - let dot = '.' as u8; + let dot = b'.'; let extlen = extension.container_as_bytes().len(); match (name.rposition_elem(&dot), extlen) { (None, 0) | (Some(0), 0) => None, diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 877ca2c7e01..9a4bc11f5c0 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -237,7 +237,7 @@ impl GenericPath for Path { match self.sepidx { None if b"." == self.repr.as_slice() => false, None => { - self.repr = vec!['.' as u8]; + self.repr = vec![b'.']; self.sepidx = None; true } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index d9b802b38fd..c3a217bf940 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -737,12 +737,12 @@ impl Path { let mut comps = comps; match (comps.is_some(),prefix) { (false, Some(DiskPrefix)) => { - if s.as_bytes()[0] >= 'a' as u8 && s.as_bytes()[0] <= 'z' as u8 { + if s.as_bytes()[0] >= b'a' && s.as_bytes()[0] <= b'z' { comps = Some(vec![]); } } (false, Some(VerbatimDiskPrefix)) => { - if s.as_bytes()[4] >= 'a' as u8 && s.as_bytes()[0] <= 'z' as u8 { + if s.as_bytes()[4] >= b'a' && s.as_bytes()[0] <= b'z' { comps = Some(vec![]); } } @@ -1010,7 +1010,7 @@ fn parse_prefix<'a>(mut path: &'a str) -> Option<PathPrefix> { } else { // \\?\path let idx = path.find('\\'); - if idx == Some(2) && path.as_bytes()[1] == ':' as u8 { + if idx == Some(2) && path.as_bytes()[1] == b':' { let c = path.as_bytes()[0]; if c.is_ascii() && (c as char).is_alphabetic() { // \\?\C:\ path @@ -1033,7 +1033,7 @@ fn parse_prefix<'a>(mut path: &'a str) -> Option<PathPrefix> { } _ => () } - } else if path.len() > 1 && path.as_bytes()[1] == ':' as u8 { + } else if path.len() > 1 && path.as_bytes()[1] == b':' { // C: let c = path.as_bytes()[0]; if c.is_ascii() && (c as char).is_alphabetic() { |
