Remove redundant to_str() conversion (#2527)

This commit is contained in:
Lena 2025-02-21 09:04:27 +01:00 committed by GitHub
parent e611e79274
commit 7f30be88e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,9 +76,7 @@ impl SyntaxText {
scope_time!("syntax_highlighting.0");
let plain_text = || SYNTAX_SET.find_syntax_plain_text();
let syntax = SYNTAX_SET
.find_syntax_for_file(
file_path.to_str().unwrap_or_default(),
)
.find_syntax_for_file(file_path)
.unwrap_or_else(|e| {
log::error!("Could not read the file to detect its syntax: {e}");
Some(plain_text())