base: Fix some clippy warnings

master
Damir Jelić 2021-01-02 13:54:47 +01:00
parent 807c58649d
commit 0edef38eb7
2 changed files with 6 additions and 8 deletions

View File

@ -386,12 +386,7 @@ fn main() -> io::Result<()> {
let database_path = matches.args.get("database").expect("No database path");
let json = matches.is_present("json");
let color = if atty::is(Stream::Stdout) {
true
} else {
false
};
let color = atty::is(Stream::Stdout);
let inspector = Inspector::new(&database_path.vals[0].to_string_lossy(), json, color);

View File

@ -136,6 +136,7 @@ impl Room {
///
/// [spec]:
/// <https://matrix.org/docs/spec/client_server/latest#calculating-the-display-name-for-a-room>
#[allow(clippy::await_holding_lock)]
pub async fn calculate_name(&self) -> String {
let inner = self.inner.read().unwrap();
@ -151,8 +152,6 @@ impl Room {
let heroes_count = inner.summary.heroes.len() as u64;
let invited_joined = (invited + joined).saturating_sub(1);
let members = self.get_active_members().await;
info!(
"Calculating name for {}, own user {} hero count {} heroes {:#?}",
self.room_id(),
@ -181,6 +180,8 @@ impl Room {
names.sort();
names.join(", ")
} else if heroes_count >= invited_joined {
let members = self.get_active_members().await;
let mut names = members
.filter(|m| future::ready(is_own_member(m)))
.take(3)
@ -195,6 +196,8 @@ impl Room {
names.sort();
names.join(", ")
} else if heroes_count < invited_joined && invited + joined > 1 {
let members = self.get_active_members().await;
let mut names = members
.filter(|m| future::ready(is_own_member(m)))
.take(3)