mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
chore: Fix clippy warnings
This commit is contained in:
@@ -219,14 +219,14 @@ async fn is_event_report_valid(
|
|||||||
fn build_report(report: Report) -> RoomMessageEventContent {
|
fn build_report(report: Report) -> RoomMessageEventContent {
|
||||||
let mut text =
|
let mut text =
|
||||||
format!("@room New {} report received from {}:\n\n", report.report_type, report.sender);
|
format!("@room New {} report received from {}:\n\n", report.report_type, report.sender);
|
||||||
if report.user_id.is_some() {
|
if let Some(user_id) = report.user_id {
|
||||||
let _ = writeln!(text, "- Reported User ID: `{}`", report.user_id.unwrap());
|
let _ = writeln!(text, "- Reported User ID: `{user_id}`");
|
||||||
}
|
}
|
||||||
if report.room_id.is_some() {
|
if let Some(room_id) = report.room_id {
|
||||||
let _ = writeln!(text, "- Reported Room ID: `{}`", report.room_id.unwrap());
|
let _ = writeln!(text, "- Reported Room ID: `{room_id}`");
|
||||||
}
|
}
|
||||||
if report.event_id.is_some() {
|
if let Some(event_id) = report.event_id {
|
||||||
let _ = writeln!(text, "- Reported Event ID: `{}`", report.event_id.unwrap());
|
let _ = writeln!(text, "- Reported Event ID: `{event_id}`");
|
||||||
}
|
}
|
||||||
let _ = writeln!(text, "- Report Reason: {}", report.reason);
|
let _ = writeln!(text, "- Report Reason: {}", report.reason);
|
||||||
|
|
||||||
|
|||||||
@@ -284,11 +284,11 @@ fn is_within_bounds() {
|
|||||||
use utils::time::{TimeDirection, is_within_bounds};
|
use utils::time::{TimeDirection, is_within_bounds};
|
||||||
|
|
||||||
let now = SystemTime::now();
|
let now = SystemTime::now();
|
||||||
let yesterday = now - Duration::from_secs(86400);
|
let yesterday = now - Duration::from_hours(24);
|
||||||
assert!(is_within_bounds(yesterday, now, TimeDirection::Before));
|
assert!(is_within_bounds(yesterday, now, TimeDirection::Before));
|
||||||
assert!(!is_within_bounds(yesterday, now, TimeDirection::After));
|
assert!(!is_within_bounds(yesterday, now, TimeDirection::After));
|
||||||
|
|
||||||
let tomorrow = now + Duration::from_secs(86400);
|
let tomorrow = now + Duration::from_hours(24);
|
||||||
assert!(is_within_bounds(tomorrow, now, TimeDirection::After));
|
assert!(is_within_bounds(tomorrow, now, TimeDirection::After));
|
||||||
assert!(!is_within_bounds(tomorrow, now, TimeDirection::Before));
|
assert!(!is_within_bounds(tomorrow, now, TimeDirection::Before));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user