chore: Fix several style lints (#17488)

It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-09-06 11:58:39 +02:00 committed by GitHub
parent 93249fc82b
commit e6c1c51b37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
361 changed files with 3530 additions and 3587 deletions

View file

@ -36,16 +36,15 @@ impl KeymapBlock {
#[serde(transparent)]
pub struct KeymapAction(Value);
impl ToString for KeymapAction {
fn to_string(&self) -> String {
impl std::fmt::Display for KeymapAction {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self.0 {
Value::String(s) => s.clone(),
Value::Array(arr) => arr
.iter()
.map(|v| v.to_string())
.collect::<Vec<_>>()
.join(", "),
_ => self.0.to_string(),
Value::String(s) => write!(f, "{}", s),
Value::Array(arr) => {
let strings: Vec<String> = arr.iter().map(|v| v.to_string()).collect();
write!(f, "{}", strings.join(", "))
}
_ => write!(f, "{}", self.0),
}
}
}