aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2024-01-05 18:52:32 -0800
committerDavid Tolnay <dtolnay@gmail.com>2024-01-05 18:58:33 -0800
commit92f405d4c81c067cf7688d0549a9938b412ee803 (patch)
treec7b2bd7ddef4d35b655077ffc7c05450fec2dc1e
parent2e0af3bd060e3c50bed39a536a6fc868715f0544 (diff)
downloadcxx-92f405d4c81c067cf7688d0549a9938b412ee803.tar.gz
Work around new dead_code warnings
warning: field `0` is never read --> macro/src/syntax/mod.rs:52:13 | 52 | Include(Include), | ------- ^^^^^^^ | | | field in this variant | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 52 | Include(()), | ~~ warning: fields `0` and `1` are never read --> macro/src/syntax/cfg.rs:9:8 | 9 | Eq(Ident, Option<LitStr>), | -- ^^^^^ ^^^^^^^^^^^^^^ | | | fields in this variant | help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields | 9 | Eq((), ()), | ~~ ~~ warning: field `0` is never read --> macro/src/syntax/cfg.rs:11:9 | 11 | Any(Vec<CfgExpr>), | --- ^^^^^^^^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 11 | Any(()), | ~~ warning: field `0` is never read --> macro/src/syntax/cfg.rs:12:9 | 12 | Not(Box<CfgExpr>), | --- ^^^^^^^^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 12 | Not(()), | ~~ warning: field `0` is never read --> src/lib.rs:551:13 | 551 | struct void(core::ffi::c_void); | ---- ^^^^^^^^^^^^^^^^^ | | | field in this struct | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 551 | struct void(()); | ~~ warning: field `0` is never read --> tests/ffi/lib.rs:411:26 | 411 | pub struct Reference<'a>(&'a String); | --------- ^^^^^^^^^^ | | | field in this struct | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 411 | pub struct Reference<'a>(()); | ~~
-rw-r--r--src/lib.rs2
-rw-r--r--syntax/cfg.rs3
-rw-r--r--syntax/mod.rs1
-rw-r--r--tests/ffi/lib.rs2
4 files changed, 6 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d2c7cf39..34a88592 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -548,4 +548,4 @@ chars! {
}
#[repr(transparent)]
-struct void(core::ffi::c_void);
+struct void(#[allow(dead_code)] core::ffi::c_void);
diff --git a/syntax/cfg.rs b/syntax/cfg.rs
index 83511d73..070813ee 100644
--- a/syntax/cfg.rs
+++ b/syntax/cfg.rs
@@ -6,9 +6,12 @@ use syn::{parenthesized, token, Attribute, LitStr, Token};
#[derive(Clone)]
pub(crate) enum CfgExpr {
Unconditional,
+ #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
Eq(Ident, Option<LitStr>),
All(Vec<CfgExpr>),
+ #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
Any(Vec<CfgExpr>),
+ #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
Not(Box<CfgExpr>),
}
diff --git a/syntax/mod.rs b/syntax/mod.rs
index 5ff343b4..eacba554 100644
--- a/syntax/mod.rs
+++ b/syntax/mod.rs
@@ -49,6 +49,7 @@ pub(crate) use self::parse::parse_items;
pub(crate) use self::types::Types;
pub(crate) enum Api {
+ #[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
Include(Include),
Struct(Struct),
Enum(Enum),
diff --git a/tests/ffi/lib.rs b/tests/ffi/lib.rs
index ef8d5b37..f3a8310f 100644
--- a/tests/ffi/lib.rs
+++ b/tests/ffi/lib.rs
@@ -408,7 +408,7 @@ impl R {
}
}
-pub struct Reference<'a>(&'a String);
+pub struct Reference<'a>(pub &'a String);
impl ffi::Shared {
fn r_method_on_shared(&self) -> String {