Fix new clippy warnings
This commit is contained in:
parent
f2a8dd7a55
commit
0f64a6ea39
@ -149,7 +149,7 @@ fn deserialize_custom_state_event() {
|
||||
&& origin_server_ts == UNIX_EPOCH + Duration::from_millis(10)
|
||||
&& sender == user_id!("@carl:example.com")
|
||||
&& room_id == room_id!("!room:room.com")
|
||||
&& state_key == ""
|
||||
&& state_key.is_empty()
|
||||
&& !unsigned.is_empty()
|
||||
);
|
||||
}
|
||||
@ -183,7 +183,7 @@ fn deserialize_custom_state_sync_event() {
|
||||
&& event_id == event_id!("$h29iv0s8:example.com")
|
||||
&& origin_server_ts == UNIX_EPOCH + Duration::from_millis(10)
|
||||
&& sender == user_id!("@carl:example.com")
|
||||
&& state_key == ""
|
||||
&& state_key.is_empty()
|
||||
&& !unsigned.is_empty()
|
||||
);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ fn serialize_stub_as_v1() {
|
||||
let json = json!({
|
||||
"sender": "@sender:example.com",
|
||||
"origin": "matrix.org",
|
||||
"origin_server_ts": 1_592_050_773_658 as usize,
|
||||
"origin_server_ts": 1_592_050_773_658usize,
|
||||
"type": "m.room.power_levels",
|
||||
"content": {
|
||||
"testing": 123
|
||||
@ -108,7 +108,7 @@ fn serialize_stub_as_v3() {
|
||||
let json = json!({
|
||||
"sender": "@sender:example.com",
|
||||
"origin": "matrix.org",
|
||||
"origin_server_ts": 1_592_050_773_658 as usize,
|
||||
"origin_server_ts": 1_592_050_773_658usize,
|
||||
"type": "m.room.power_levels",
|
||||
"content": {
|
||||
"testing": 123
|
||||
@ -271,7 +271,7 @@ fn serialize_pdu_as_v1() {
|
||||
"event_id": "$somejoinevent:matrix.org",
|
||||
"sender": "@sender:example.com",
|
||||
"origin": "matrix.org",
|
||||
"origin_server_ts": 1_592_050_773_658 as usize,
|
||||
"origin_server_ts": 1_592_050_773_658usize,
|
||||
"type": "m.room.power_levels",
|
||||
"content": {
|
||||
"testing": 123
|
||||
@ -330,7 +330,7 @@ fn serialize_pdu_as_v3() {
|
||||
"room_id": "!n8f893n9:example.com",
|
||||
"sender": "@sender:example.com",
|
||||
"origin": "matrix.org",
|
||||
"origin_server_ts": 1_592_050_773_658 as usize,
|
||||
"origin_server_ts": 1_592_050_773_658usize,
|
||||
"type": "m.room.power_levels",
|
||||
"content": {
|
||||
"testing": 123
|
||||
|
@ -124,7 +124,7 @@ fn deserialize_aliases_with_prev_content() {
|
||||
&& prev_content.aliases == vec![room_alias_id!("#inner:localhost")]
|
||||
&& room_id == room_id!("!roomid:room.com")
|
||||
&& sender == user_id!("@carl:example.com")
|
||||
&& state_key == ""
|
||||
&& state_key.is_empty()
|
||||
&& unsigned.is_empty()
|
||||
);
|
||||
}
|
||||
@ -150,7 +150,7 @@ fn deserialize_aliases_sync_with_room_id() {
|
||||
&& origin_server_ts == UNIX_EPOCH + Duration::from_millis(1)
|
||||
&& prev_content.aliases == vec![room_alias_id!("#inner:localhost")]
|
||||
&& sender == user_id!("@carl:example.com")
|
||||
&& state_key == ""
|
||||
&& state_key.is_empty()
|
||||
&& unsigned.is_empty()
|
||||
);
|
||||
}
|
||||
@ -204,7 +204,7 @@ fn deserialize_avatar_without_prev_content() {
|
||||
&& origin_server_ts == UNIX_EPOCH + Duration::from_millis(1)
|
||||
&& room_id == room_id!("!roomid:room.com")
|
||||
&& sender == user_id!("@carl:example.com")
|
||||
&& state_key == ""
|
||||
&& state_key.is_empty()
|
||||
&& matches!(
|
||||
info.as_ref(),
|
||||
ImageInfo {
|
||||
@ -311,7 +311,7 @@ fn deserialize_full_event_convert_to_sync() {
|
||||
&& origin_server_ts == UNIX_EPOCH + Duration::from_millis(1)
|
||||
&& prev_content.aliases == vec![room_alias_id!("#inner:localhost")]
|
||||
&& sender == "@carl:example.com"
|
||||
&& state_key == ""
|
||||
&& state_key.is_empty()
|
||||
&& unsigned.is_empty()
|
||||
);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ mod tests {
|
||||
assert_matches!(
|
||||
deserialize(json).unwrap(),
|
||||
RoomState { origin, auth_chain, state }
|
||||
if origin == ""
|
||||
if origin.is_empty()
|
||||
&& auth_chain.is_empty()
|
||||
&& state.is_empty()
|
||||
);
|
||||
|
@ -294,6 +294,7 @@ mod tweak_serde {
|
||||
mod test {
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use js_int::uint;
|
||||
use ruma_events::EventType;
|
||||
use ruma_identifiers::{event_id, room_alias_id, room_id, user_id};
|
||||
use serde_json::{
|
||||
@ -335,38 +336,38 @@ mod test {
|
||||
let uid = user_id!("@exampleuser:matrix.org");
|
||||
let alias = room_alias_id!("#exampleroom:matrix.org");
|
||||
|
||||
let mut count = NotificationCounts::default();
|
||||
count.unread = js_int::uint!(2);
|
||||
// test default values are ignored
|
||||
count.missed_calls = js_int::uint!(0);
|
||||
let count = NotificationCounts { unread: uint!(2), ..NotificationCounts::default() };
|
||||
|
||||
let mut device = Device::new(
|
||||
"org.matrix.matrixConsole.ios".into(),
|
||||
"V2h5IG9uIGVhcnRoIGRpZCB5b3UgZGVjb2RlIHRoaXM/".into(),
|
||||
);
|
||||
device.pushkey_ts = Some(SystemTime::UNIX_EPOCH + Duration::from_secs(123));
|
||||
device.tweaks = vec![
|
||||
let device = Device {
|
||||
pushkey_ts: Some(SystemTime::UNIX_EPOCH + Duration::from_secs(123)),
|
||||
tweaks: vec![
|
||||
Tweak::Highlight(true),
|
||||
Tweak::Sound("silence".into()),
|
||||
Tweak::Custom {
|
||||
name: "custom".into(),
|
||||
value: from_json_value(JsonValue::String("go wild".into())).unwrap(),
|
||||
},
|
||||
];
|
||||
],
|
||||
..Device::new(
|
||||
"org.matrix.matrixConsole.ios".into(),
|
||||
"V2h5IG9uIGVhcnRoIGRpZCB5b3UgZGVjb2RlIHRoaXM/".into(),
|
||||
)
|
||||
};
|
||||
let devices = &[device];
|
||||
|
||||
let devices = vec![device];
|
||||
|
||||
let mut notice = Notification::default();
|
||||
notice.event_id = Some(&eid);
|
||||
notice.room_id = Some(&rid);
|
||||
notice.event_type = Some(&EventType::RoomMessage);
|
||||
notice.sender = Some(&uid);
|
||||
notice.sender_display_name = Some("Major Tom");
|
||||
notice.room_alias = Some(&alias);
|
||||
notice.content = Some(serde_json::from_str("{}").unwrap());
|
||||
notice.counts = count;
|
||||
notice.prio = NotificationPriority::Low;
|
||||
notice.devices = &devices;
|
||||
let notice = Notification {
|
||||
event_id: Some(&eid),
|
||||
room_id: Some(&rid),
|
||||
event_type: Some(&EventType::RoomMessage),
|
||||
sender: Some(&uid),
|
||||
sender_display_name: Some("Major Tom"),
|
||||
room_alias: Some(&alias),
|
||||
content: Some(serde_json::from_str("{}").unwrap()),
|
||||
counts: count,
|
||||
prio: NotificationPriority::Low,
|
||||
devices,
|
||||
..Notification::default()
|
||||
};
|
||||
|
||||
assert_eq!(expected, to_json_value(notice).unwrap())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user