From 985acf23ef71ea5192d9b67c4ff8da9614ec7927 Mon Sep 17 00:00:00 2001 From: extrawurst Date: Thu, 2 Nov 2023 07:45:52 +0100 Subject: [PATCH] fix nighyly clippy --- invalidstring/src/lib.rs | 1 + src/components/utils/logitems.rs | 11 +++++++++++ src/options.rs | 2 +- src/strings.rs | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/invalidstring/src/lib.rs b/invalidstring/src/lib.rs index 99415dcf..175d8168 100644 --- a/invalidstring/src/lib.rs +++ b/invalidstring/src/lib.rs @@ -1,4 +1,5 @@ /// uses unsafe to postfix the string with invalid utf8 data +#[allow(invalid_from_utf8_unchecked)] pub fn invalid_utf8(prefix: &str) -> String { let bytes = b"\xc3\x73"; diff --git a/src/components/utils/logitems.rs b/src/components/utils/logitems.rs index 12d72862..d6f8de79 100644 --- a/src/components/utils/logitems.rs +++ b/src/components/utils/logitems.rs @@ -157,6 +157,17 @@ impl ItemBatch { } } +impl<'a> IntoIterator for &'a ItemBatch { + type IntoIter = std::slice::Iter< + 'a, + crate::components::utils::logitems::LogEntry, + >; + type Item = &'a crate::components::utils::logitems::LogEntry; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + #[cfg(test)] #[cfg(feature = "ghemoji")] mod tests { diff --git a/src/options.rs b/src/options.rs index 4c0424c7..68cebd0a 100644 --- a/src/options.rs +++ b/src/options.rs @@ -145,7 +145,7 @@ impl Options { fn save_failable(&self) -> Result<()> { let dir = Self::options_file(&self.repo)?; - let mut file = File::create(&dir)?; + let mut file = File::create(dir)?; let data = to_string_pretty(&self.data, PrettyConfig::default())?; file.write_all(data.as_bytes())?; diff --git a/src/strings.rs b/src/strings.rs index 7a73b1f9..6c3b061a 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -131,9 +131,9 @@ pub const fn branch_name_invalid() -> &'static str { "[invalid name]" } pub fn commit_editor_msg(_key_config: &SharedKeyConfig) -> String { - r##" + r" # Edit your commit message -# Lines starting with '#' will be ignored"## +# Lines starting with '#' will be ignored" .to_string() } pub fn stash_popup_title(_key_config: &SharedKeyConfig) -> String {