Fix clippy lints

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This commit is contained in:
Manos Pitsidianakis 2023-11-19 14:42:07 +02:00
parent 0e60bdf26e
commit 688e39a67e
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0
9 changed files with 17 additions and 22 deletions

View File

@ -78,7 +78,7 @@ impl std::fmt::Display for JobManager {
}
impl JobManager {
const HEADERS: [&str; 5] = ["id", "desc", "started", "finished", "succeeded"];
const HEADERS: [&'static str; 5] = ["id", "desc", "started", "finished", "succeeded"];
pub fn new(context: &Context) -> Self {
let theme_default = crate::conf::value(context, "theme_default");

View File

@ -1899,7 +1899,7 @@ impl Component for Composer {
);
let f = create_temp_file(
self.draft.to_edit_string().as_str().as_bytes(),
self.draft.to_edit_string().as_bytes(),
None,
None,
Some("eml"),

View File

@ -57,7 +57,7 @@ pub fn edit_config() -> Result<()> {
})?;
let config_path = crate::conf::get_config_file()?;
let mut cmd = Command::new(&editor);
let mut cmd = Command::new(editor);
let mut handle = &mut cmd;
for c in crate::conf::get_included_configs(config_path)? {

View File

@ -265,7 +265,7 @@ impl EmbedGrid {
ref mut scroll_region,
ref mut terminal_size,
ref mut alternate_screen,
ref mut state,
state: _,
ref mut fg_color,
ref mut bg_color,
ref mut attrs,
@ -347,8 +347,7 @@ impl EmbedGrid {
};
}
#[allow(clippy::redundant_locals)]
let mut state = state;
let mut state = &mut self.state;
match (byte, &mut state) {
(b'\x1b', State::Normal) => {
*state = State::ExpectingControlChar;

View File

@ -158,10 +158,10 @@ impl<const N: usize> Default for DataColumns<N> {
}
impl<const N: usize> DataColumns<N> {
pub const ARROW_UP: &str = "🠉";
pub const ARROW_DOWN: &str = "🠋";
pub const ARROW_UP_ASCII: &str = "^";
pub const ARROW_DOWN_ASCII: &str = "v";
pub const ARROW_UP: &'static str = "🠉";
pub const ARROW_DOWN: &'static str = "🠋";
pub const ARROW_UP_ASCII: &'static str = "^";
pub const ARROW_DOWN_ASCII: &'static str = "v";
// const ARROW_UP_1: &str = "↑";
// const ARROW_DOWN_1: &str = "↓";
// const ARROW_UP_3: &str = "▲";

View File

@ -40,7 +40,7 @@ pub struct Mailto {
}
impl Mailto {
pub const IGNORE_HEADERS: &[HeaderName] = &[
pub const IGNORE_HEADERS: &'static [HeaderName] = &[
HeaderName::FROM,
HeaderName::DATE,
HeaderName::MESSAGE_ID,
@ -97,7 +97,7 @@ impl Mailto {
HeaderName::USER_AGENT,
];
pub const MAILTO_CHARSET: &AsciiSet = &CONTROLS
pub const MAILTO_CHARSET: &'static AsciiSet = &CONTROLS
.add(b' ')
.add(b'"')
.add(b'"')

View File

@ -1188,12 +1188,8 @@ unsafe impl Sync for Data {}
impl Drop for Data {
#[inline]
fn drop(&mut self) {
if !self.inner.as_ptr().is_null() {
match self.kind {
DataKind::Memory => unsafe {
call!(self.lib, gpgme_data_release)(self.inner.as_mut())
},
}
match self.kind {
DataKind::Memory => unsafe { call!(self.lib, gpgme_data_release)(self.inner.as_mut()) },
}
}
}

View File

@ -975,7 +975,7 @@ impl MailBackend for ImapType {
}
let ret: Result<()> = ImapResponse::try_from(response.as_slice())?.into();
ret?;
let new_hash = MailboxHash::from_bytes(path.as_str().as_bytes());
let new_hash = MailboxHash::from_bytes(path.as_bytes());
uid_store.mailboxes.lock().await.clear();
Ok((
new_hash,
@ -1141,7 +1141,7 @@ impl MailBackend for ImapType {
.read_response(&mut response, RequiredResponses::empty())
.await?;
}
let new_hash = MailboxHash::from_bytes(new_path.as_str().as_bytes());
let new_hash = MailboxHash::from_bytes(new_path.as_bytes());
let ret: Result<()> = ImapResponse::try_from(response.as_slice())?.into();
ret?;
uid_store.mailboxes.lock().await.clear();

View File

@ -61,8 +61,8 @@ pub mod html_escape {
}
impl HtmlEntity {
pub const ALL: [&str; 4] = ["&lt;", "&gt;", "&amp;", "&quot;"];
pub const GLYPHS: [&str; 4] = ["<", ">", "&", "\""];
pub const ALL: [&'static str; 4] = ["&lt;", "&gt;", "&amp;", "&quot;"];
pub const GLYPHS: [&'static str; 4] = ["<", ">", "&", "\""];
pub const fn glyph(self) -> char {
match self {