Skip to content

Commit dd2f14c

Browse files
committed
chore: remove the 'tokio::main' attribute macro
Because its expansion uses expect() and we don't want that ;) We use '?' on .build() if we can't build the tokio runtime
1 parent 19fc437 commit dd2f14c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,21 @@ async fn root_handler() -> &'static str {
5252
"I'm Alive :D"
5353
}
5454

55+
#[expect(clippy::absolute_paths, reason = "use one-time only")]
56+
fn main() -> Result<(), Error> {
57+
tokio::runtime::Builder::new_current_thread()
58+
.enable_all()
59+
.build()?
60+
.block_on(async { tokio_main().await })
61+
}
62+
5563
#[expect(
5664
clippy::integer_division_remainder_used,
5765
reason = "Because clippy is not happy with the tokio::select macro #1"
5866
)]
59-
#[tokio::main(flavor = "current_thread")]
6067
#[instrument]
61-
async fn main() -> Result<(), Error> {
68+
/// Entrypoint executed by the tokio runtime
69+
async fn tokio_main() -> Result<(), Error> {
6270
// Configure tracing_subscriber with a custom formatter
6371
#[expect(clippy::absolute_paths, reason = "Only call to this function")]
6472
tracing_subscriber::fmt()

0 commit comments

Comments
 (0)