Upgrade rust/crates/protobuf-codegen to 2.16.2
Test: make
Change-Id: I14166e5bd65e98c7c7a53cff992df72164346bc5
diff --git a/src/code_writer.rs b/src/code_writer.rs
index 61ce92f..9f3f3a0 100644
--- a/src/code_writer.rs
+++ b/src/code_writer.rs
@@ -55,7 +55,8 @@
self.write_line("#![allow(unknown_lints)]");
self.write_line("#![allow(clippy::all)]");
self.write_line("");
- self.write_line("#![cfg_attr(rustfmt, rustfmt_skip)]");
+ self.write_line("#![allow(unused_attributes)]");
+ self.write_line("#![rustfmt::skip]");
self.write_line("");
self.write_line("#![allow(box_pointers)]");
self.write_line("#![allow(dead_code)]");
@@ -64,7 +65,6 @@
self.write_line("#![allow(non_snake_case)]");
self.write_line("#![allow(non_upper_case_globals)]");
self.write_line("#![allow(trivial_casts)]");
- self.write_line("#![allow(unsafe_code)]");
self.write_line("#![allow(unused_imports)]");
self.write_line("#![allow(unused_results)]");
}
@@ -108,7 +108,7 @@
pub fn lazy_static_protobuf_path(&mut self, name: &str, ty: &str, protobuf_crate_path: &str) {
self.write_line(&format!(
- "static mut {}: {}::lazy::Lazy<{}> = {}::lazy::Lazy::INIT;",
+ "static {}: {}::rt::LazyV2<{}> = {}::rt::LazyV2::INIT;",
name, protobuf_crate_path, ty, protobuf_crate_path,
));
}
@@ -118,18 +118,14 @@
F: Fn(&mut CodeWriter),
{
self.lazy_static(name, ty);
- self.unsafe_expr(|w| {
- w.write_line(&format!("{}.get(|| {{", name));
- w.indented(|w| init(w));
- w.write_line(&format!("}})"));
- });
+ self.write_line(&format!("{}.get(|| {{", name));
+ self.indented(|w| init(w));
+ self.write_line(&format!("}})"));
}
pub fn lazy_static_decl_get_simple(&mut self, name: &str, ty: &str, init: &str) {
self.lazy_static(name, ty);
- self.unsafe_expr(|w| {
- w.write_line(&format!("{}.get({})", name, init));
- });
+ self.write_line(&format!("{}.get({})", name, init));
}
pub fn block<F>(&mut self, first_line: &str, last_line: &str, cb: F)