Skip to content

Commit 10c1db6

Browse files
committed
Compact Debug implementation for *ConfigInput
1 parent 7b4c364 commit 10c1db6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2321,12 +2321,24 @@ macro_rules! _config_data {
23212321

23222322
/// All fields `Option<T>`, `None` representing fields not set in a particular JSON/TOML blob.
23232323
#[allow(non_snake_case)]
2324-
#[derive(Debug, Clone, Serialize, Default)]
2324+
#[derive(Clone, Serialize, Default)]
23252325
struct $input { $(
23262326
#[serde(skip_serializing_if = "Option::is_none")]
23272327
$field: Option<$ty>,
23282328
)* }
23292329

2330+
impl std::fmt::Debug for $input {
2331+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2332+
let mut s = f.debug_struct(stringify!($input));
2333+
$(
2334+
if let Some(val) = self.$field.as_ref() {
2335+
s.field(stringify!($field), val);
2336+
}
2337+
)*
2338+
s.finish()
2339+
}
2340+
}
2341+
23302342
/// Newtype of
23312343
#[doc = stringify!($name)]
23322344
/// expressing that this was read directly from a single, root config blob.

0 commit comments

Comments
 (0)