[O] Optimize
This commit is contained in:
@@ -521,7 +521,7 @@ async fn pull_input(mt: Arc<Mutex<Mutes>>, cn: &Consts) -> Result<()> {
|
||||
fn run() -> Result<()> {
|
||||
pretty_env_logger::init();
|
||||
|
||||
let cn: &Consts = Box::leak(Box::new(Consts::new()));
|
||||
let cn: Consts = Consts::new();
|
||||
let mt = Arc::new(Mutex::new(Mutes::new(&cn)));
|
||||
|
||||
// Set terminal to raw mode
|
||||
@@ -540,8 +540,8 @@ fn run() -> Result<()> {
|
||||
// Start update_loop and pull_input concurrently and wait for them to finish
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
rt.block_on(async {
|
||||
let update_loop = start_update_loop( mt.clone(), cn);
|
||||
let pull_input = pull_input(mt.clone(), cn);
|
||||
let update_loop = start_update_loop( mt.clone(), &cn);
|
||||
let pull_input = pull_input(mt.clone(), &cn);
|
||||
tokio::try_join!(update_loop, pull_input)?;
|
||||
Ok::<(), Error>(())
|
||||
})?;
|
||||
|
||||
Reference in New Issue
Block a user