Arguments are no longer arced.

This commit is contained in:
Filipe Rodrigues 2022-04-07 22:28:36 +01:00
parent 43e8e35b20
commit 392d817c3e
No known key found for this signature in database
GPG Key ID: A0E31C6EE7CB70F0
2 changed files with 5 additions and 8 deletions

View File

@ -41,7 +41,7 @@ use {
};
/// Runs the application
pub async fn run(args: Arc<Args>) -> Result<(), anyhow::Error> {
pub async fn run(args: &Args) -> Result<(), anyhow::Error> {
// Build the window
let (mut event_loop, window) = self::create_window()?;
let window = Arc::new(window);
@ -55,7 +55,7 @@ pub async fn run(args: Arc<Args>) -> Result<(), anyhow::Error> {
let mut event_handler = EventHandler::new();
// Spawn all futures
let join_handle = self::spawn_services(&services, &resources, &args);
let join_handle = self::spawn_services(&services, &resources, args);
// Run the event loop until exit
event_loop.run_return(|event, _, control_flow| {

View File

@ -84,10 +84,7 @@ use {
clap::StructOpt,
std::{
num::NonZeroUsize,
sync::{
atomic::{self, AtomicUsize},
Arc,
},
sync::atomic::{self, AtomicUsize},
thread,
},
};
@ -106,7 +103,7 @@ fn main() -> Result<(), anyhow::Error> {
// Get arguments
let args = match Args::try_parse() {
Ok(args) => Arc::new(args),
Ok(args) => args,
Err(err) => {
tracing::warn!(?err, "Unable to retrieve arguments");
err.exit();
@ -133,7 +130,7 @@ fn main() -> Result<(), anyhow::Error> {
// Run the app and restart if we get an error (up to 5 errors)
let mut errors = 0;
while errors < 5 {
match runtime.block_on(app::run(Arc::clone(&args))) {
match runtime.block_on(app::run(&args)) {
Ok(()) => {
tracing::info!("Application finished");
break;