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/file.rs b/src/file.rs
index 0c21d99..413e1bc 100644
--- a/src/file.rs
+++ b/src/file.rs
@@ -13,7 +13,7 @@
}
pub(crate) fn proto_path_to_rust_mod(path: &str) -> RustIdent {
- let without_dir = strx::remove_to(path, '/');
+ let without_dir = strx::remove_to(path, std::path::is_separator);
let without_suffix = strx::remove_suffix(without_dir, ".proto");
let name = without_suffix
@@ -67,4 +67,21 @@
fn test_mod_path_empty_ext() {
assert_eq!(RustIdent::from("proto"), proto_path_to_rust_mod("proto"));
}
+
+ #[test]
+ fn test_mod_path_dir() {
+ assert_eq!(
+ RustIdent::from("baz"),
+ proto_path_to_rust_mod("foo/bar/baz.proto"),
+ )
+ }
+
+ #[cfg(target_os = "windows")]
+ #[test]
+ fn test_mod_path_dir_backslashes() {
+ assert_eq!(
+ RustIdent::from("baz"),
+ proto_path_to_rust_mod("foo\\bar\\baz.proto"),
+ )
+ }
}