enable manual_string_new lint

This commit is contained in:
Charles Hall 2024-05-14 17:37:57 -07:00
parent 9606f59141
commit 645d88177a
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
4 changed files with 24 additions and 23 deletions

View file

@ -45,6 +45,7 @@ items_after_statements = "warn"
let_underscore_must_use = "warn" let_underscore_must_use = "warn"
lossy_float_literal = "warn" lossy_float_literal = "warn"
manual_let_else = "warn" manual_let_else = "warn"
manual_string_new = "warn"
mem_forget = "warn" mem_forget = "warn"
missing_assert_message = "warn" missing_assert_message = "warn"
mod_module_files = "warn" mod_module_files = "warn"

View file

@ -228,7 +228,7 @@ pub(crate) async fn create_room_route(
event_type: TimelineEventType::RoomCreate, event_type: TimelineEventType::RoomCreate,
content: to_raw_value(&content).expect("event is valid, we just created it"), content: to_raw_value(&content).expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -309,7 +309,7 @@ pub(crate) async fn create_room_route(
content: to_raw_value(&power_levels_content) content: to_raw_value(&power_levels_content)
.expect("to_raw_value always works on serde_json::Value"), .expect("to_raw_value always works on serde_json::Value"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -332,7 +332,7 @@ pub(crate) async fn create_room_route(
}) })
.expect("We checked that alias earlier, it must be fine"), .expect("We checked that alias earlier, it must be fine"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -358,7 +358,7 @@ pub(crate) async fn create_room_route(
})) }))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -379,7 +379,7 @@ pub(crate) async fn create_room_route(
)) ))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -401,7 +401,7 @@ pub(crate) async fn create_room_route(
})) }))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -418,7 +418,7 @@ pub(crate) async fn create_room_route(
})?; })?;
// Implicit state key defaults to "" // Implicit state key defaults to ""
pdu_builder.state_key.get_or_insert_with(|| "".to_owned()); pdu_builder.state_key.get_or_insert_with(String::new);
// Silently skip encryption events if they are not allowed // Silently skip encryption events if they are not allowed
if pdu_builder.event_type == TimelineEventType::RoomEncryption if pdu_builder.event_type == TimelineEventType::RoomEncryption
@ -445,7 +445,7 @@ pub(crate) async fn create_room_route(
content: to_raw_value(&RoomNameEventContent::new(name.clone())) content: to_raw_value(&RoomNameEventContent::new(name.clone()))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -467,7 +467,7 @@ pub(crate) async fn create_room_route(
}) })
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -628,7 +628,7 @@ pub(crate) async fn upgrade_room_route(
}) })
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -729,7 +729,7 @@ pub(crate) async fn upgrade_room_route(
content: to_raw_value(&create_event_content) content: to_raw_value(&create_event_content)
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -799,7 +799,7 @@ pub(crate) async fn upgrade_room_route(
event_type: event_type.to_string().into(), event_type: event_type.to_string().into(),
content: event_content, content: event_content,
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,
@ -849,7 +849,7 @@ pub(crate) async fn upgrade_room_route(
content: to_raw_value(&power_levels_event_content) content: to_raw_value(&power_levels_event_content)
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
sender_user, sender_user,

View file

@ -983,7 +983,7 @@ impl Service {
event_type: TimelineEventType::RoomCreate, event_type: TimelineEventType::RoomCreate,
content: to_raw_value(&content).expect("event is valid, we just created it"), content: to_raw_value(&content).expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1036,7 +1036,7 @@ impl Service {
}) })
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1055,7 +1055,7 @@ impl Service {
content: to_raw_value(&RoomJoinRulesEventContent::new(JoinRule::Invite)) content: to_raw_value(&RoomJoinRulesEventContent::new(JoinRule::Invite))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1076,7 +1076,7 @@ impl Service {
)) ))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1097,7 +1097,7 @@ impl Service {
)) ))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1117,7 +1117,7 @@ impl Service {
content: to_raw_value(&RoomNameEventContent::new(room_name)) content: to_raw_value(&RoomNameEventContent::new(room_name))
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1137,7 +1137,7 @@ impl Service {
}) })
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1163,7 +1163,7 @@ impl Service {
}) })
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,
@ -1288,7 +1288,7 @@ impl Service {
}) })
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
unsigned: None, unsigned: None,
state_key: Some("".to_owned()), state_key: Some(String::new()),
redacts: None, redacts: None,
}, },
&grapevine_user, &grapevine_user,

View file

@ -435,7 +435,7 @@ impl Service {
// The original create event must be in the auth events // The original create event must be in the auth events
if !matches!( if !matches!(
auth_events auth_events
.get(&(StateEventType::RoomCreate, "".to_owned())) .get(&(StateEventType::RoomCreate, String::new()))
.map(|a| a.as_ref()), .map(|a| a.as_ref()),
Some(_) | None Some(_) | None
) { ) {