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 database_path = matches.args.get("database").expect("No database path");
let json = matches.is_present("json"); let json = matches.is_present("json");
let color = atty::is(Stream::Stdout);
let color = if atty::is(Stream::Stdout) {
true
} else {
false
};
let inspector = Inspector::new(&database_path.vals[0].to_string_lossy(), json, color); let inspector = Inspector::new(&database_path.vals[0].to_string_lossy(), json, color);

View File

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