Skip to content

Commit cd196aa

Browse files
committed
Implement Debug for SourceText
This is useful for using it with `dbg!()`.
1 parent 0c87db2 commit cd196aa

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)