diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2025-09-14 02:51:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-14 02:51:32 +0000 |
| commit | adcd2defc79cf4e573254c6a3f6803c37b085ec1 (patch) | |
| tree | dca5500f7834e6e76b7e3eaa448c5b5be90dc07d | |
| parent | 544e24a79fd5564d7abf84263e5f70fe06fa226d (diff) | |
| parent | cd196aa72a638b627ecdcfd3495b986300af83f1 (diff) | |
| download | rust-adcd2defc79cf4e573254c6a3f6803c37b085ec1.tar.gz rust-adcd2defc79cf4e573254c6a3f6803c37b085ec1.zip | |
Implement `Debug` for `SourceText` (#15672)
This is useful for using it with `dbg!()`. changelog: none r? Jarcho
| -rw-r--r-- | clippy_utils/src/source.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clippy_utils/src/source.rs b/clippy_utils/src/source.rs index e675291b6f3..638d3290312 100644 --- a/clippy_utils/src/source.rs +++ b/clippy_utils/src/source.rs @@ -215,6 +215,11 @@ impl fmt::Display for SourceText { self.as_str().fmt(f) } } +impl fmt::Debug for SourceText { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.as_str().fmt(f) + } +} fn get_source_range(sm: &SourceMap, sp: Range<BytePos>) -> Option<SourceFileRange> { let start = sm.lookup_byte_offset(sp.start); |
