Skip to content

Commit f5975af

Browse files
committed
fix: just format and lint fixes
1 parent 075c068 commit f5975af

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

crates/rostra-core/src/event/bincode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
use convi::ExpectInto as _;
32

43
use super::{

crates/rostra-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub struct Timestamp(pub u64);
134134
impl Timestamp {
135135
pub const ZERO: Self = Self(0);
136136
pub const MAX: Self = Self(u64::MAX);
137-
137+
138138
pub fn now() -> Self {
139139
Self(time::OffsetDateTime::now_utc().unix_timestamp() as u64)
140140
}

crates/rostra-web-ui/assets/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,4 +1372,4 @@ input:checked+.slider:before {
13721372

13731373
.o-mediaList__closeButton {
13741374
background-color: var(--color-button-bg);
1375-
}
1375+
}

crates/rostra-web-ui/src/routes/post.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ pub async fn fetch_missing_post(
136136
}))
137137
}
138138

139-
140139
#[bon::bon]
141140
impl UiState {
142141
#[allow(clippy::too_many_arguments)]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub mod time;
1+
pub mod time;
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
1-
use rostra_core::Timestamp;
21
use std::time::{SystemTime, UNIX_EPOCH};
32

3+
use rostra_core::Timestamp;
4+
45
pub fn format_timestamp(timestamp: Timestamp) -> String {
56
let system_time: SystemTime = UNIX_EPOCH + std::time::Duration::from_secs(timestamp.0);
67
let now = SystemTime::now();
78
let duration_since = now.duration_since(system_time).unwrap_or_default();
8-
9+
910
let seconds = duration_since.as_secs();
10-
11+
1112
if seconds < 60 {
12-
format!("{}s", seconds)
13+
format!("{seconds}s")
1314
} else if seconds < 3600 {
1415
format!("{}m", seconds / 60)
1516
} else if seconds < 86400 {
1617
format!("{}h", seconds / 3600)
17-
} else if seconds < 2592000 { // 30 days
18+
} else if seconds < 2592000 {
19+
// 30 days
1820
format!("{}d", seconds / 86400)
1921
} else {
2022
// For older posts, show the actual date
2123
let timestamp_secs = system_time
2224
.duration_since(UNIX_EPOCH)
2325
.unwrap_or_default()
2426
.as_secs();
25-
27+
2628
// Simple date formatting (would be better with chrono crate)
2729
let days_since_epoch = timestamp_secs / 86400;
2830
let year = 1970 + days_since_epoch / 365;
2931
let day_of_year = days_since_epoch % 365;
3032
let month = day_of_year / 30 + 1;
3133
let day = day_of_year % 30 + 1;
32-
33-
format!("{}/{}/{}", month, day, year)
34+
35+
format!("{month}/{day}/{year}")
3436
}
35-
}
37+
}

0 commit comments

Comments
 (0)