Skip to content

Commit 6cabc31

Browse files
committed
improve hygiene
1 parent 40c646e commit 6cabc31

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

partialdebug-derive/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pub fn derive_non_exhaustive(input: TokenStream) -> TokenStream {
3131
let name = &field.ident;
3232
quote! {
3333
match ::partialdebug::specialization::AsDebug::as_debug(&self. #name) {
34-
None => {
34+
::core::option::Option::None => {
3535
__exhaustive = false;
3636
}
37-
Some(field) => {
37+
::core::option::Option::Some(field) => {
3838
__s.field(stringify!(#name), field);
3939
}
4040
}
@@ -195,8 +195,8 @@ fn gen_field_as_debug(
195195
.field(
196196
#name_arg
197197
match ::partialdebug::specialization::AsDebug::as_debug(&#field_handle){
198-
None => &::partialdebug::Placeholder(#placeholder_string),
199-
Some(__field) => __field,
198+
::core::option::Option::None => &::partialdebug::Placeholder(#placeholder_string),
199+
::core::option::Option::Some(__field) => __field,
200200
},
201201
)
202202
}
@@ -219,8 +219,8 @@ fn gen_field_as_debug(
219219
.field(
220220
#name_arg
221221
match ::partialdebug::no_specialization::DebugDetector::<#field_type>::as_debug(&#field_handle){
222-
None => &::partialdebug::Placeholder(#placeholder_string),
223-
Some(__field) => __field,
222+
::core::option::Option::None => &::partialdebug::Placeholder(#placeholder_string),
223+
::core::option::Option::Some(__field) => __field,
224224
},
225225
)
226226
}

tests/hygiene.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
#![no_implicit_prelude]
22
#![no_std]
33
#![cfg_attr(feature = "unstable", feature(debug_non_exhaustive))]
4+
#![allow(dead_code)]
45

56
use ::partialdebug;
67

7-
// These are required for now
8-
use ::core::option::Option::*;
9-
10-
#[cfg_attr(
11-
feature = "unstable",
12-
derive(partialdebug::non_exhaustive::PartialDebug)
13-
)]
148
#[cfg(feature = "unstable")]
9+
#[derive(partialdebug::non_exhaustive::PartialDebug)]
1510
struct NonExhaustive {
1611
field: usize,
1712
}

tests/placeholder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ mod partial {
2020
}
2121
}
2222

23+
#[allow(dead_code)]
2324
mod normal {
2425
#[derive(Debug)]
2526
pub struct UnitStruct;

0 commit comments

Comments
 (0)