Skip to content

Commit 0b69157

Browse files
committed
Fix newlines
1 parent 6437c37 commit 0b69157

File tree

1 file changed

+6
-9
lines changed
  • tokio-postgres/src/error

1 file changed

+6
-9
lines changed

tokio-postgres/src/error/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,14 @@ impl DbError {
257257
let mut before_str = before[before.len().saturating_sub(2)..].join("\n");
258258
before_str.push_str(after.first().copied().unwrap_or_default());
259259

260-
let after_str = after.get(1).copied().unwrap_or_default();
260+
let indent = before.last().copied().unwrap_or_default().chars().count();
261+
let mut out = format!("{before_str}\n{:width$}^", "", width = indent);
261262

262-
let indent = before.last().copied().unwrap_or_default().len();
263+
if let Some(after_str) = after.get(1).copied() {
264+
out = format!("{out}\n{after_str}")
265+
}
263266

264-
Some(format!(
265-
"{before_str}\n
266-
{:width$}^
267-
{after_str}",
268-
"",
269-
width = indent
270-
))
267+
Some(out)
271268
}
272269

273270
/// An indication of the context in which the error occurred.

0 commit comments

Comments
 (0)