Browse Source

Remove some needless clones and stuff (thanks to Clippy)

tags/alpha-0.6.0
Manos Pitsidianakis 3 months ago
parent
commit
9db6b07b71
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS. GPG Key ID: 73627C2F690DF710
9 changed files with 27 additions and 30 deletions
  1. +2
    -2
      config_macros.rs
  2. +2
    -5
      melib/src/backends/imap/connection.rs
  3. +1
    -1
      src/components/mail/listing/offline.rs
  4. +2
    -2
      src/conf.rs
  5. +4
    -4
      src/conf/accounts.rs
  6. +4
    -4
      src/jobs.rs
  7. +5
    -5
      src/mailcap.rs
  8. +6
    -6
      src/plugins.rs
  9. +1
    -1
      src/plugins/rpc.rs

+ 2
- 2
config_macros.rs View File

@ -105,13 +105,13 @@ use super::*;
return Some(new_attr);
}
if attr_inner_value.starts_with("( default =") {
let rest = g.stream().clone().into_iter().skip(4);
let rest = g.stream().into_iter().skip(4);
new_attr.tokens = quote! { ( #(#rest)*) };
if new_attr.tokens.to_string().as_str() == "( )" {
return None;
}
} else if attr_inner_value.starts_with("( default") {
let rest = g.stream().clone().into_iter().skip(2);
let rest = g.stream().into_iter().skip(2);
new_attr.tokens = quote! { ( #(#rest)*) };
if new_attr.tokens.to_string().as_str() == "( )" {
return None;

+ 2
- 5
melib/src/backends/imap/connection.rs View File

@ -446,11 +446,8 @@ impl ImapConnection {
return Ok(());
}
let new_stream = debug!(ImapStream::new_connection(&self.server_conf).await);
if new_stream.is_err() {
*self.uid_store.is_online.lock().unwrap() = (
Instant::now(),
Err(new_stream.as_ref().unwrap_err().clone()),
);
if let Err(err) = new_stream.as_ref() {
*self.uid_store.is_online.lock().unwrap() = (Instant::now(), Err(err.clone()));
} else {
*self.uid_store.is_online.lock().unwrap() = (Instant::now(), Ok(()));
}

+ 1
- 1
src/components/mail/listing/offline.rs View File

@ -166,7 +166,7 @@ impl Component for OfflineListing {
self.dirty
}
fn set_dirty(&mut self, value: bool) {
fn set_dirty(&mut self, _value: bool) {
self.dirty = true;
}

+ 2
- 2
src/conf.rs View File

@ -787,7 +787,7 @@ mod pp {
p = prefix.join(p)
}
ret.extend(pp_helper(&p, level + 1)?.chars());
ret.push_str(&pp_helper(&p, level + 1)?);
} else {
ret.push_str(l);
ret.push('\n');
@ -812,7 +812,7 @@ mod pp {
for theme_mailbox in xdg_dirs.find_config_files("themes") {
let read_dir = std::fs::read_dir(theme_mailbox)?;
for theme in read_dir {
ret.extend(pp_helper(&theme?.path(), 0)?.chars());
ret.push_str(&pp_helper(&theme?.path(), 0)?);
}
}
}

+ 4
- 4
src/conf/accounts.rs View File

@ -1055,11 +1055,11 @@ impl Account {
}
Ok(AsyncStatus::Payload(payload)) => {
debug!("got payload in status for {}", mailbox_hash);
if payload.is_err() {
if let Err(err) = payload {
self.mailbox_entries
.entry(mailbox_hash)
.and_modify(|entry| {
entry.status = MailboxStatus::Failed(payload.unwrap_err());
entry.status = MailboxStatus::Failed(err);
});
self.sender
.send(ThreadEvent::UIEvent(UIEvent::StartupCheck(mailbox_hash)))
@ -1554,11 +1554,11 @@ impl Account {
self.active_jobs
.insert(job_id, JobRequest::Get(mailbox_hash, rcvr));
let payload = payload.unwrap();
if payload.is_err() {
if let Err(err) = payload {
self.mailbox_entries
.entry(mailbox_hash)
.and_modify(|entry| {
entry.status = MailboxStatus::Failed(payload.unwrap_err());
entry.status = MailboxStatus::Failed(err);
});
self.sender
.send(ThreadEvent::UIEvent(UIEvent::MailboxUpdate((

+ 4
- 4
src/jobs.rs View File

@ -157,8 +157,8 @@ impl JobExecutor {
F: Future<Output = Result<()>> + Send + 'static,
{
let job_id = JobId::new();
let _job_id = job_id.clone();
let __job_id = job_id.clone();
let _job_id = job_id;
let __job_id = job_id;
let finished_sender = self.sender.clone();
let injector = self.global_queue.clone();
// Create a task and schedule it for execution.
@ -191,8 +191,8 @@ impl JobExecutor {
let (sender, receiver) = oneshot::channel();
let finished_sender = self.sender.clone();
let job_id = JobId::new();
let _job_id = job_id.clone();
let __job_id = job_id.clone();
let _job_id = job_id;
let __job_id = job_id;
let injector = self.global_queue.clone();
// Create a task and schedule it for execution.
let (task, _) = async_task::spawn(

+ 5
- 5
src/mailcap.rs View File

@ -81,16 +81,16 @@ impl MailcapEntry {
let mut lines_iter = content.lines();
while let Some(l) = lines_iter.next() {
let l = l.trim();
if l.starts_with("#";) {
if l.starts_with('#';) {
continue;
}
if l.is_empty() {
continue;
}
if l.ends_with("\\";) {
if l.ends_with('\\';) {
let l = format!("{}{}", &l[..l.len() - 2], lines_iter.next().unwrap());
let mut parts_iter = l.split(";";);
let mut parts_iter = l.split(';';);
let key = parts_iter.next().unwrap();
let cmd = parts_iter.next().unwrap();
//let flags = parts_iter.next().unwrap();
@ -112,7 +112,7 @@ impl MailcapEntry {
}
hash_map.insert(key.to_string(), cmd.to_string());
} else {
let mut parts_iter = l.split(";";);
let mut parts_iter = l.split(';';);
let key = parts_iter.next().unwrap();
let cmd = parts_iter.next().unwrap();
//let flags = parts_iter.next().unwrap();
@ -163,7 +163,7 @@ impl MailcapEntry {
p
}
"%t" => a.content_type().to_string(),
param if param.starts_with("%{") && param.ends_with("}";) => {
param if param.starts_with("%{") && param.ends_with('}';) => {
let param = &param["%{".len()..param.len() - 1];
if let Some(v) = params.iter().find(|(k, _)| *k == param.as_bytes()) {
String::from_utf8_lossy(v.1).into()

+ 6
- 6
src/plugins.rs View File

@ -188,22 +188,22 @@ impl PluginManager {
let channel = RpcChannel::new(stream, &session)?;
for h in &plugin.hooks {
self.add_listener(h, session.clone());
self.add_listener(h, session);
}
self.instances.insert(session.clone(), child);
self.sessions.insert(session.clone(), plugin.name.clone());
self.streams.insert(session.clone(), channel);
self.instances.insert(session, child);
self.sessions.insert(session, plugin.name.clone());
self.streams.insert(session, channel);
self.plugins.insert(plugin.name.clone(), plugin);
Ok(())
}
PluginKind::Filter => {
let session = Uuid::new_v4();
for h in &plugin.hooks {
self.add_listener(h, session.clone());
self.add_listener(h, session);
}
self.sessions.insert(session.clone(), plugin.name.clone());
self.sessions.insert(session, plugin.name.clone());
self.plugins.insert(plugin.name.clone(), plugin);
/* send init message to plugin to register hooks */
Ok(())

+ 1
- 1
src/plugins/rpc.rs View File

@ -37,7 +37,7 @@ impl RpcChannel {
pub fn new(stream: UnixStream, session: &Uuid) -> Result<RpcChannel> {
let mut ret = RpcChannel {
stream,
session: session.clone(),
session: *session,
};
let greeting: PluginGreeting = ret.from_read().map_err(|err| {
MeliError::new(format!("Could not get correct plugin greeting: {}", err))

Loading…
Cancel
Save