1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-07-09 15:37:45 +00:00

Address two of "warning: function call inside of expect"

This commit is contained in:
The Dax 2025-07-04 10:40:45 -04:00 committed by Joshua Goins
parent 72915e11d9
commit b3b7b2e57f

View file

@ -537,9 +537,10 @@ async fn client_loop(
let connection_data = scope
.create_userdata_ref_mut(&mut lua_player)?;
/* TODO: Instead of panicking we ought to send a message to the player
* and the console log, and abandon execution. */
lua.load(
std::fs::read(&file_name)
.expect(format!("Failed to load script file {}!", &file_name).as_str()),
std::fs::read(&file_name).unwrap_or_else(|_| panic!("Failed to load script file {}!", &file_name)),
)
.set_name("@".to_string() + &file_name)
.exec()?;
@ -643,10 +644,10 @@ async fn client_loop(
lua.scope(|scope| {
let connection_data = scope
.create_userdata_ref_mut(&mut lua_player)?;
/* TODO: Instead of panicking we ought to send a message to the player
* and the console log, and abandon execution. */
lua.load(
std::fs::read(&file_name)
.expect(format!("Failed to load script file {}!", &file_name).as_str()),
std::fs::read(&file_name).unwrap_or_else(|_| panic!("Failed to load script file {}!", &file_name)),
)
.set_name("@".to_string() + &file_name)
.exec()?;