Upgrade rust/crates/protobuf-codegen to 2.17.0
* Android.bp was regenerated. New rurstc warnings were found.
* Keep local change in src/lib.rs; set rust-protobuf version to "2.17.0".
Change-Id: I84fd880955dad26e4490b5110bd44573fde0da02
Test: make
diff --git a/src/strx.rs b/src/strx.rs
index e822bf8..d1b26fa 100644
--- a/src/strx.rs
+++ b/src/strx.rs
@@ -1,5 +1,8 @@
-pub fn remove_to<'s>(s: &'s str, c: char) -> &'s str {
- match s.rfind(c) {
+pub fn remove_to<'s, P>(s: &'s str, pattern: P) -> &'s str
+where
+ P: Fn(char) -> bool,
+{
+ match s.rfind(pattern) {
Some(pos) => &s[(pos + 1)..],
None => s,
}
@@ -34,9 +37,9 @@
#[test]
fn test_remove_to() {
- assert_eq!("aaa", remove_to("aaa", '.'));
- assert_eq!("bbb", remove_to("aaa.bbb", '.'));
- assert_eq!("ccc", remove_to("aaa.bbb.ccc", '.'));
+ assert_eq!("aaa", remove_to("aaa", |c| c == '.'));
+ assert_eq!("bbb", remove_to("aaa.bbb", |c| c == '.'));
+ assert_eq!("ccc", remove_to("aaa.bbb.ccc", |c| c == '.'));
}
#[test]