diff options
author | ZJPzjp | 2023-05-11 05:44:52 +0000 |
---|---|---|
committer | GitHub | 2023-05-11 05:44:52 +0000 |
commit | 3b8c15618f51889ffd2f2f4be32f8404c1517956 (patch) | |
tree | e3083a28d98fe1faf45fc37b9bdd28340fd6186e /helix-core/src/syntax.rs | |
parent | 1e5997dc98ecd82b09ccee9fbe8d5350fd333fad (diff) |
Fix warnings from clippy (#7013)
* Fix warnings from clippy
* revert MAIN_SEPARATOR_STR
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r-- | helix-core/src/syntax.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 6514b40f..005e985d 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -187,9 +187,12 @@ impl<'de> Deserialize<'de> for FileType { M: serde::de::MapAccess<'de>, { match map.next_entry::<String, String>()? { - Some((key, suffix)) if key == "suffix" => Ok(FileType::Suffix( - suffix.replace('/', &std::path::MAIN_SEPARATOR.to_string()), - )), + Some((key, suffix)) if key == "suffix" => Ok(FileType::Suffix({ + // FIXME: use `suffix.replace('/', std::path::MAIN_SEPARATOR_STR)` + // if MSRV is updated to 1.68 + let mut seperator = [0; 1]; + suffix.replace('/', std::path::MAIN_SEPARATOR.encode_utf8(&mut seperator)) + })), Some((key, _value)) => Err(serde::de::Error::custom(format!( "unknown key in `file-types` list: {}", key |