Address a number of clippy complaints

This commit is contained in:
2020-05-16 14:51:41 +01:00
parent 33d522779a
commit 640948241a
4 changed files with 20 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
mod avatars;
pub use self::avatars::*;
#[allow(clippy::module_inception)]
mod connection;
pub use self::connection::*;
@@ -69,7 +70,7 @@ impl Connection {
};
let mut dbfile = directories::ProjectDirs::from("gs", "ur", "telepathy-padfoot")
.ok_or(MethodErr::no_arg())
.ok_or_else(MethodErr::no_arg)
.and_then(|p| Ok(p.data_local_dir().to_path_buf()))?;
dbfile.push(&id);
@@ -137,9 +138,9 @@ impl Connection {
Ok(Connection {
id,
msgq,
ctx: Arc::new(RwLock::new(ctx)),
state: Arc::new(RwLock::new(ConnState::Initial)),
msgq: msgq.clone(),
})
}
@@ -177,12 +178,11 @@ impl Connection {
let requests_iface =
telepathy::connection_interface_requests_server(&f, (), move |_| c_rc5.clone());
let c_rc6 = c_rc.clone();
let simple_presence_iface =
telepathy::connection_interface_simple_presence_server(&f, (), move |_| c_rc6.clone());
telepathy::connection_interface_simple_presence_server(&f, (), move |_| c_rc.clone());
tree = tree.add(
f.object_path(path.clone(), ())
f.object_path(path, ())
.introspectable()
.add(conn_iface)
.add(avatars_iface)
@@ -223,18 +223,14 @@ impl Connection {
println!("Error processing: {}", e);
return;
}
};
// Spend a bit of time sending any outgoing messages - signals, mostly
loop {
let msg = match msgq.lock().unwrap().pop_front() {
Some(msg) => msg,
None => break,
};
while let Some(msg) = msgq.lock().unwrap().pop_front() {
print!("Connection<{}>: Sending message...", id);
match c.send(msg) {
Err(e) => println!("error! {:?}", e),
Err(e) => println!("error! {:?}", e), // FIXME: handle error better?
_ => println!("OK!"),
}
}