Skip to content

Commit 92f405d

Browse files
committed
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>(()); | ~~
1 parent 2e0af3b commit 92f405d

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,4 +548,4 @@ chars! {
548548
}
549549

550550
#[repr(transparent)]
551-
struct void(core::ffi::c_void);
551+
struct void(#[allow(dead_code)] core::ffi::c_void);

syntax/cfg.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ use syn::{parenthesized, token, Attribute, LitStr, Token};
66
#[derive(Clone)]
77
pub(crate) enum CfgExpr {
88
Unconditional,
9+
#[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
910
Eq(Ident, Option<LitStr>),
1011
All(Vec<CfgExpr>),
12+
#[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
1113
Any(Vec<CfgExpr>),
14+
#[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
1215
Not(Box<CfgExpr>),
1316
}
1417

syntax/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub(crate) use self::parse::parse_items;
4949
pub(crate) use self::types::Types;
5050

5151
pub(crate) enum Api {
52+
#[allow(dead_code)] // only used by cxx-build, not cxxbridge-macro
5253
Include(Include),
5354
Struct(Struct),
5455
Enum(Enum),

tests/ffi/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl R {
408408
}
409409
}
410410

411-
pub struct Reference<'a>(&'a String);
411+
pub struct Reference<'a>(pub &'a String);
412412

413413
impl ffi::Shared {
414414
fn r_method_on_shared(&self) -> String {

0 commit comments

Comments
 (0)