Skip to content

Commit b9cd864

Browse files
committed
Fix dead_code warning on fallback SourceFile
warning: struct `SourceFile` is never constructed --> src/fallback.rs:301:19 | 301 | pub(crate) struct SourceFile { | ^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: methods `path` and `is_real` are never used --> src/fallback.rs:307:12 | 305 | impl SourceFile { | --------------- methods in this implementation 306 | /// Get the path to this source file as a string. 307 | pub fn path(&self) -> PathBuf { | ^^^^ ... 311 | pub fn is_real(&self) -> bool { | ^^^^^^^
1 parent e94f432 commit b9cd864

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/fallback.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use core::ops::Range;
1616
use core::ops::RangeBounds;
1717
use core::ptr;
1818
use core::str::FromStr;
19+
#[cfg(procmacro2_semver_exempt)]
1920
use std::path::PathBuf;
2021

2122
/// Force use of proc-macro2's fallback implementation of the API for now, even
@@ -297,11 +298,13 @@ impl IntoIterator for TokenStream {
297298
}
298299
}
299300

301+
#[cfg(procmacro2_semver_exempt)]
300302
#[derive(Clone, PartialEq, Eq)]
301303
pub(crate) struct SourceFile {
302304
path: PathBuf,
303305
}
304306

307+
#[cfg(procmacro2_semver_exempt)]
305308
impl SourceFile {
306309
/// Get the path to this source file as a string.
307310
pub fn path(&self) -> PathBuf {
@@ -313,6 +316,7 @@ impl SourceFile {
313316
}
314317
}
315318

319+
#[cfg(procmacro2_semver_exempt)]
316320
impl Debug for SourceFile {
317321
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
318322
f.debug_struct("SourceFile")

0 commit comments

Comments
 (0)