diff options
| author | bors <bors@rust-lang.org> | 2014-11-06 08:06:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-06 08:06:50 +0000 |
| commit | e84e7a00ddec76570bbaa9afea385d544f616814 (patch) | |
| tree | 5757b1eec689ab03459c9f2518cc602284c44733 /src/libregex | |
| parent | 0e2f9b948564708085373fc28d91b4524c821fa3 (diff) | |
| parent | 11f4baeafb83459befd0196b2b82cda7ed5ea2f1 (diff) | |
| download | rust-e84e7a00ddec76570bbaa9afea385d544f616814.tar.gz rust-e84e7a00ddec76570bbaa9afea385d544f616814.zip | |
auto merge of #18467 : japaric/rust/eq, r=alexcrichton
`eq`, `ne`, `cmp`, etc methods now require one less level of indirection when dealing with `&str`/`&[T]`
``` rust
"foo".ne(&"bar") -> "foo".ne("bar")
slice.cmp(&another_slice) -> slice.cmp(another_slice)
// slice and another_slice have type `&[T]`
```
[breaking-change]
Diffstat (limited to 'src/libregex')
| -rw-r--r-- | src/libregex/parse.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libregex/parse.rs b/src/libregex/parse.rs index 3115161682f..6723ea725a3 100644 --- a/src/libregex/parse.rs +++ b/src/libregex/parse.rs @@ -1020,6 +1020,8 @@ fn is_valid_cap(c: char) -> bool { || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') } +// NOTE(stage0): remove function after a snapshot +#[cfg(stage0)] fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> { match classes.binary_search(|&(s, _)| s.cmp(&name)) { slice::Found(i) => Some(classes[i].val1().to_vec()), @@ -1027,6 +1029,14 @@ fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> { } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> { + match classes.binary_search(|&(s, _)| s.cmp(name)) { + slice::Found(i) => Some(classes[i].val1().to_vec()), + slice::NotFound(_) => None, + } +} + type Class = &'static [(char, char)]; type NamedClasses = &'static [(&'static str, &'static Class)]; |
