Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
poga committed Jul 25, 2018
1 parent 524b6c0 commit 2adea56
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl LuaActor {
let vm = Lua::new();
vm.eval::<()>(&script, Some("Init"))?;

Result::Ok(LuaActor { vm: vm })
Result::Ok(LuaActor { vm })
}

pub fn new_from_file(path: &str) -> Result<LuaActor, LuaError> {
Expand Down
18 changes: 14 additions & 4 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ macro_rules! lua_message_convert_int {
($x:ty) => {
impl From<$x> for LuaMessage {
fn from(s: $x) -> Self {
LuaMessage::Integer(s as i64)
LuaMessage::Integer(i64::from(s))
}
}
};
Expand All @@ -60,14 +60,24 @@ lua_message_convert_int!(u16);
lua_message_convert_int!(i32);
lua_message_convert_int!(u32);
lua_message_convert_int!(i64);
lua_message_convert_int!(isize);
lua_message_convert_int!(usize);

impl From<usize> for LuaMessage {
fn from(s: usize) -> Self {
LuaMessage::Integer(s as i64)
}
}

impl From<isize> for LuaMessage {
fn from(s: isize) -> Self {
LuaMessage::Integer(s as i64)
}
}

macro_rules! lua_message_convert_float {
($x:ty) => {
impl From<$x> for LuaMessage {
fn from(s: $x) -> Self {
LuaMessage::Number(s as f64)
LuaMessage::Number(f64::from(s))
}
}
};
Expand Down

0 comments on commit 2adea56

Please sign in to comment.