mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
use a number for the maximum indentation instead of relying on str::len()
This commit is contained in:
+2
-2
@@ -44,8 +44,8 @@ fn init_logger() {
|
||||
let format = |record: &log::LogRecord| {
|
||||
// prepend spaces to indent the final string
|
||||
let indentation = log_settings::settings().indentation;
|
||||
let spaces = " | | | | | | | | ";
|
||||
let indentation = &spaces[..std::cmp::min(indentation, spaces.len())];
|
||||
let spaces = " | | | | | | | | |";
|
||||
let indentation = &spaces[..std::cmp::min(indentation, 44)];
|
||||
format!("{}:{}|{} {}", record.level(), record.location().module_path(), indentation, record.args())
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user