Skip to content

Commit 734a0b5

Browse files
committed
show trusted pubblishing crate diff
1 parent d6ea153 commit 734a0b5

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

sync-team/src/crates_io/mod.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,34 @@ impl Diff {
165165
}
166166

167167
pub(crate) fn is_empty(&self) -> bool {
168-
self.config_diffs.is_empty()
168+
// Destructure struct to get compiler errors when new fields are added
169+
let &Diff {
170+
ref config_diffs,
171+
ref crate_diffs,
172+
} = self;
173+
174+
config_diffs.is_empty() && crate_diffs.is_empty()
169175
}
170176
}
171177

172178
impl std::fmt::Display for Diff {
173179
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
174-
if !&self.config_diffs.is_empty() {
180+
// Destructure struct to get compiler errors when new fields are added
181+
let &Diff {
182+
ref config_diffs,
183+
ref crate_diffs,
184+
} = self;
185+
186+
if !config_diffs.is_empty() {
175187
writeln!(f, "💻 Trusted Publishing Config Diffs:")?;
176-
for diff in &self.config_diffs {
188+
for diff in config_diffs {
189+
write!(f, "{diff}")?;
190+
}
191+
}
192+
193+
if !crate_diffs.is_empty() {
194+
writeln!(f, "💻 Trusted Publishing Crate Diffs:")?;
195+
for diff in crate_diffs {
177196
write!(f, "{diff}")?;
178197
}
179198
}

0 commit comments

Comments
 (0)