remove various unnecessary qualifications
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
aedb5966fe
commit
7c1624931d
17 changed files with 39 additions and 42 deletions
|
@ -609,9 +609,7 @@ impl Service {
|
|||
Err(_) => RoomMessageEventContent::text_plain("Failed to get appservice."),
|
||||
},
|
||||
AppserviceCommand::List => {
|
||||
if let Ok(appservices) =
|
||||
services().appservice.iter_ids().map(std::iter::Iterator::collect::<Vec<_>>)
|
||||
{
|
||||
if let Ok(appservices) = services().appservice.iter_ids().map(Iterator::collect::<Vec<_>>) {
|
||||
let count = appservices.len();
|
||||
let output = format!(
|
||||
"Appservices ({}): {}",
|
||||
|
|
|
@ -469,7 +469,7 @@ impl Service<'_> {
|
|||
if self.unix_socket_path().is_some() {
|
||||
match &self.unix_socket_path() {
|
||||
Some(path) => {
|
||||
std::fs::remove_file(path).unwrap();
|
||||
fs::remove_file(path).unwrap();
|
||||
},
|
||||
None => error!(
|
||||
"Unable to remove socket file at {:?} during shutdown.",
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Service {
|
|||
debug!("Got local file path: {:?}", file_path);
|
||||
|
||||
debug!("Deleting local file {:?} from filesystem, original MXC: {}", file_path, mxc);
|
||||
tokio::fs::remove_file(file_path).await?;
|
||||
fs::remove_file(file_path).await?;
|
||||
|
||||
debug!("Deleting MXC {mxc} from database");
|
||||
self.db.delete_file_mxc(mxc.clone())?;
|
||||
|
@ -318,20 +318,20 @@ impl Service {
|
|||
u64::from(original_width) * u64::from(height) / u64::from(original_height)
|
||||
};
|
||||
if use_width {
|
||||
if intermediate <= u64::from(::std::u32::MAX) {
|
||||
if intermediate <= u64::from(std::u32::MAX) {
|
||||
(width, intermediate as u32)
|
||||
} else {
|
||||
(
|
||||
(u64::from(width) * u64::from(::std::u32::MAX) / intermediate) as u32,
|
||||
::std::u32::MAX,
|
||||
(u64::from(width) * u64::from(std::u32::MAX) / intermediate) as u32,
|
||||
std::u32::MAX,
|
||||
)
|
||||
}
|
||||
} else if intermediate <= u64::from(::std::u32::MAX) {
|
||||
} else if intermediate <= u64::from(std::u32::MAX) {
|
||||
(intermediate as u32, height)
|
||||
} else {
|
||||
(
|
||||
::std::u32::MAX,
|
||||
(u64::from(height) * u64::from(::std::u32::MAX) / intermediate) as u32,
|
||||
std::u32::MAX,
|
||||
(u64::from(height) * u64::from(std::u32::MAX) / intermediate) as u32,
|
||||
)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -55,7 +55,7 @@ impl Service {
|
|||
warn!("Failed to find destination {}: {}", destination, e);
|
||||
Error::BadServerResponse("Invalid destination")
|
||||
})?
|
||||
.map(bytes::BytesMut::freeze);
|
||||
.map(BytesMut::freeze);
|
||||
|
||||
let reqwest_request = reqwest::Request::try_from(http_request)?;
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ impl Service {
|
|||
|
||||
// The original create event must be in the auth events
|
||||
if !matches!(
|
||||
auth_events.get(&(StateEventType::RoomCreate, "".to_owned())).map(std::convert::AsRef::as_ref),
|
||||
auth_events.get(&(StateEventType::RoomCreate, "".to_owned())).map(AsRef::as_ref),
|
||||
Some(_) | None
|
||||
) {
|
||||
return Err(Error::BadRequest(
|
||||
|
@ -623,8 +623,7 @@ impl Service {
|
|||
.get_shortstatekey(&StateEventType::RoomCreate, "")?
|
||||
.expect("Room exists");
|
||||
|
||||
if state.get(&create_shortstatekey).map(std::convert::AsRef::as_ref) != Some(&create_event.event_id)
|
||||
{
|
||||
if state.get(&create_shortstatekey).map(AsRef::as_ref) != Some(&create_event.event_id) {
|
||||
return Err(Error::bad_database("Incoming event refers to wrong create event."));
|
||||
}
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ impl Service {
|
|||
let mut results = Vec::new();
|
||||
|
||||
while let Some(current_room) = {
|
||||
while stack.last().map_or(false, std::vec::Vec::is_empty) {
|
||||
while stack.last().map_or(false, Vec::is_empty) {
|
||||
stack.pop();
|
||||
}
|
||||
if !stack.is_empty() {
|
||||
stack.last_mut().and_then(std::vec::Vec::pop)
|
||||
stack.last_mut().and_then(Vec::pop)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -402,7 +402,7 @@ impl Service {
|
|||
match join_rule {
|
||||
JoinRule::Restricted(r) => {
|
||||
for rule in &r.allow {
|
||||
if let join_rules::AllowRule::RoomMembership(rm) = rule {
|
||||
if let AllowRule::RoomMembership(rm) = rule {
|
||||
if let Ok(true) = services().rooms.state_cache.is_joined(sender_user, &rm.room_id) {
|
||||
return Ok(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue