Ivan Lozano | b32d5e8 | 2020-08-26 15:19:37 -0400 | [diff] [blame] | 1 | From 38f7b959fdedb839ce412b7e3faa067d315fc13a Mon Sep 17 00:00:00 2001 |
| 2 | From: Ivan Lozano <ivanlozano@google.com> |
| 3 | Date: Wed, 26 Aug 2020 15:19:37 -0400 |
| 4 | Subject: [PATCH] Allow generated source to be root module src. |
| 5 | |
| 6 | rustfmt::skip breaks compilation when used as a root module source. We |
| 7 | don't run rustfmt on generated source anyhow. |
| 8 | See https://github.com/stepancheg/rust-protobuf/issues/493#issuecomment-652874447 |
| 9 | |
| 10 | Bug: 143953733 |
| 11 | Test: rust_protobuf can generate library variants. |
| 12 | Change-Id: I0ea47de25c0ddd65781d6509b09ea648d11c4277 |
| 13 | --- |
| 14 | src/code_writer.rs | 3 ++- |
| 15 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 16 | |
| 17 | diff --git a/src/code_writer.rs b/src/code_writer.rs |
| 18 | index 8b53bc6..855b785 100644 |
| 19 | --- a/src/code_writer.rs |
| 20 | +++ b/src/code_writer.rs |
| 21 | @@ -58,7 +58,8 @@ impl<'a> CodeWriter<'a> { |
| 22 | self.write_line("#![allow(clippy::all)]"); |
| 23 | self.write_line(""); |
| 24 | self.write_line("#![allow(unused_attributes)]"); |
| 25 | - self.write_line("#![rustfmt::skip]"); |
| 26 | + // ANDROID CHANGE: comment out rustfmt::skip to fix compilation error. |
| 27 | + //self.write_line("#![rustfmt::skip]"); |
| 28 | self.write_line(""); |
| 29 | self.write_line("#![allow(box_pointers)]"); |
| 30 | self.write_line("#![allow(dead_code)]"); |
| 31 | -- |
| 32 | 2.28.0.297.g1956fa8f8d-goog |
| 33 | |