Fix clippy lints
parent
5cfac42101
commit
6d67cd2ac7
|
@ -168,7 +168,7 @@ impl Client {
|
||||||
|
|
||||||
pub(crate) async fn calculate_room_names(&self) -> Vec<String> {
|
pub(crate) async fn calculate_room_names(&self) -> Vec<String> {
|
||||||
let mut res = Vec::new();
|
let mut res = Vec::new();
|
||||||
for (_id, room) in &self.joined_rooms {
|
for room in self.joined_rooms.values() {
|
||||||
let room = room.read().await;
|
let room = room.read().await;
|
||||||
res.push(room.room_name.calculate_name(&room.members))
|
res.push(room.room_name.calculate_name(&room.members))
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,8 +166,7 @@ impl RoomName {
|
||||||
.map(|mem| {
|
.map(|mem| {
|
||||||
mem.display_name
|
mem.display_name
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(mem.user_id.localpart().to_string())
|
.unwrap_or_else(|| mem.user_id.localpart().to_string())
|
||||||
.to_string()
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
// stabilize ordering
|
// stabilize ordering
|
||||||
|
@ -180,7 +179,7 @@ impl RoomName {
|
||||||
.map(|mem| {
|
.map(|mem| {
|
||||||
mem.display_name
|
mem.display_name
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(mem.user_id.localpart().to_string())
|
.unwrap_or_else(|| mem.user_id.localpart().to_string())
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
names.sort();
|
names.sort();
|
||||||
|
@ -502,7 +501,7 @@ mod test {
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
assert_eq!(2, room.members.len());
|
assert_eq!(2, room.members.len());
|
||||||
for (_id, member) in &room.members {
|
for member in room.members.values() {
|
||||||
assert_eq!(MembershipState::Join, member.membership);
|
assert_eq!(MembershipState::Join, member.membership);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ impl EventBuilder {
|
||||||
variant: fn(Ev) -> Event,
|
variant: fn(Ev) -> Event,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let val = fs::read_to_string(path.as_ref())
|
let val = fs::read_to_string(path.as_ref())
|
||||||
.expect(&format!("file not found {:?}", path.as_ref()));
|
.unwrap_or_else(|_| panic!("file not found {:?}", path.as_ref()));
|
||||||
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.deserialize()
|
.deserialize()
|
||||||
|
@ -112,7 +112,7 @@ impl EventBuilder {
|
||||||
variant: fn(Ev) -> Event,
|
variant: fn(Ev) -> Event,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let val = fs::read_to_string(path.as_ref())
|
let val = fs::read_to_string(path.as_ref())
|
||||||
.expect(&format!("file not found {:?}", path.as_ref()));
|
.unwrap_or_else(|_| panic!("file not found {:?}", path.as_ref()));
|
||||||
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.deserialize()
|
.deserialize()
|
||||||
|
@ -128,7 +128,7 @@ impl EventBuilder {
|
||||||
variant: fn(Ev) -> RoomEvent,
|
variant: fn(Ev) -> RoomEvent,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let val = fs::read_to_string(path.as_ref())
|
let val = fs::read_to_string(path.as_ref())
|
||||||
.expect(&format!("file not found {:?}", path.as_ref()));
|
.unwrap_or_else(|_| panic!("file not found {:?}", path.as_ref()));
|
||||||
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.deserialize()
|
.deserialize()
|
||||||
|
@ -144,7 +144,7 @@ impl EventBuilder {
|
||||||
variant: fn(Ev) -> StateEvent,
|
variant: fn(Ev) -> StateEvent,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let val = fs::read_to_string(path.as_ref())
|
let val = fs::read_to_string(path.as_ref())
|
||||||
.expect(&format!("file not found {:?}", path.as_ref()));
|
.unwrap_or_else(|_| panic!("file not found {:?}", path.as_ref()));
|
||||||
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
let event = serde_json::from_str::<EventJson<Ev>>(&val)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.deserialize()
|
.deserialize()
|
||||||
|
@ -156,7 +156,7 @@ impl EventBuilder {
|
||||||
/// Add a presence event to the presence events `Vec`.
|
/// Add a presence event to the presence events `Vec`.
|
||||||
pub fn add_presence_event_from_file<P: AsRef<Path>>(mut self, path: P) -> Self {
|
pub fn add_presence_event_from_file<P: AsRef<Path>>(mut self, path: P) -> Self {
|
||||||
let val = fs::read_to_string(path.as_ref())
|
let val = fs::read_to_string(path.as_ref())
|
||||||
.expect(&format!("file not found {:?}", path.as_ref()));
|
.unwrap_or_else(|_| panic!("file not found {:?}", path.as_ref()));
|
||||||
let event = serde_json::from_str::<EventJson<PresenceEvent>>(&val)
|
let event = serde_json::from_str::<EventJson<PresenceEvent>>(&val)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.deserialize()
|
.deserialize()
|
||||||
|
@ -174,7 +174,7 @@ impl EventBuilder {
|
||||||
P: AsRef<Path>,
|
P: AsRef<Path>,
|
||||||
{
|
{
|
||||||
let body = fs::read_to_string(path.as_ref())
|
let body = fs::read_to_string(path.as_ref())
|
||||||
.expect(&format!("file not found {:?}", path.as_ref()));
|
.unwrap_or_else(|_| panic!("file not found {:?}", path.as_ref()));
|
||||||
let mock = Some(
|
let mock = Some(
|
||||||
mock(method, matcher)
|
mock(method, matcher)
|
||||||
.with_status(200)
|
.with_status(200)
|
||||||
|
|
Loading…
Reference in New Issue