Skip to content

Commit adcd2de

Browse files
authored
Implement Debug for SourceText (#15672)
This is useful for using it with `dbg!()`. changelog: none r? Jarcho
2 parents 544e24a + cd196aa commit adcd2de

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clippy_utils/src/source.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ impl fmt::Display for SourceText {
215215
self.as_str().fmt(f)
216216
}
217217
}
218+
impl fmt::Debug for SourceText {
219+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
220+
self.as_str().fmt(f)
221+
}
222+
}
218223

219224
fn get_source_range(sm: &SourceMap, sp: Range<BytePos>) -> Option<SourceFileRange> {
220225
let start = sm.lookup_byte_offset(sp.start);

0 commit comments

Comments
 (0)