Skip to content

Commit ff65343

Browse files
committed
Fix log formatting in tests
Clippy points out that "format specifiers have no effect on `format_args!()`", i.e. that our attempt to fix the log context width to 55 chars doesn't do anything because its applied to the result of `format_args`ing the context. This appears to have broken when we optimized out a previous `format`, which we revert here.
1 parent 6bac667 commit ff65343

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lightning/src/util/test_utils.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,17 +1435,11 @@ impl TestLogger {
14351435

14361436
impl Logger for TestLogger {
14371437
fn log(&self, record: Record) {
1438-
let s = format!(
1439-
"{:<55} {}",
1440-
format_args!(
1441-
"{} {} [{}:{}]",
1442-
self.id,
1443-
record.level.to_string(),
1444-
record.module_path,
1445-
record.line
1446-
),
1447-
record.args
1438+
let context = format!(
1439+
"{} {} [{}:{}]",
1440+
self.id, record.level, record.module_path, record.line
14481441
);
1442+
let s = format!("{:<55} {}", context, record.args);
14491443
#[cfg(ldk_bench)]
14501444
{
14511445
// When benchmarking, we don't actually want to print logs, but we do want to format

0 commit comments

Comments
 (0)