diff --git a/src/commonargcmd.rs b/src/commonargcmd.rs index 2e2c890..80fd9a9 100644 --- a/src/commonargcmd.rs +++ b/src/commonargcmd.rs @@ -45,7 +45,7 @@ pub fn keyword_or_command( if horizon[i] == b'(' { return WhatNow{ tri: Transition::Push(Box::new(SitNormal{ - end_trigger: b')' as u16, end_replace: None + end_trigger: u16::from(b')'), end_replace: None })), pre: i, len: 1, alt: None }; } @@ -174,7 +174,7 @@ pub fn common_no_cmd_quoting_unneeded( if horizon[i] == b'`' { return Some(Ok(WhatNow{ tri: Transition::Push(Box::new(SitNormal{ - end_trigger: b'`' as u16, end_replace: None + end_trigger: u16::from(b'`'), end_replace: None })), pre: i, len: 1, alt: None })) } @@ -213,7 +213,7 @@ fn find_usual_suspects( is_horizon_lengthenable :bool, ) -> Option { let a = horizon[i]; - if a as u16 == end_trigger { + if u16::from(a) == end_trigger { return Some(Ok(WhatNow{ tri: Transition::Pop, pre: i, len: 0, alt: None })); diff --git a/src/commonstrcmd.rs b/src/commonstrcmd.rs index 4945a57..bfbf80a 100644 --- a/src/commonstrcmd.rs +++ b/src/commonstrcmd.rs @@ -40,7 +40,7 @@ pub fn common_str_cmd( ) -> CommonStrCmdResult { if horizon[i] == b'`' { let cmd = Box::new(SitNormal{ - end_trigger: b'`' as u16, end_replace: Some(b")"), + end_trigger: u16::from(b'`'), end_replace: Some(b")"), }); return CommonStrCmdResult::OnlyWithQuotes(WhatNow{ tri: Transition::Push(cmd), pre: i, len: 1, alt: Some(b"$(") @@ -99,7 +99,7 @@ pub fn common_str_cmd( } let sit = Box::new(SitNormal{ - end_trigger: b')' as u16, end_replace: None, + end_trigger: u16::from(b')'), end_replace: None, }); return CommonStrCmdResult::OnlyWithQuotes(WhatNow{ tri: Transition::Push(sit), diff --git a/src/sitcmd.rs b/src/sitcmd.rs index 2fc1ff2..0d2300a 100644 --- a/src/sitcmd.rs +++ b/src/sitcmd.rs @@ -31,7 +31,7 @@ impl Situation for SitNormal { if is_whitespace(a) || a == b';' || a == b'|' || a == b'&' || a == b'<' || a == b'>' { continue; } - if a as u16 == self.end_trigger { + if u16::from(a) == self.end_trigger { return Ok(WhatNow{ tri: Transition::Pop, pre: i, len: 1, alt: self.end_replace diff --git a/src/sitrvalue.rs b/src/sitrvalue.rs index 1669629..6b902c3 100644 --- a/src/sitrvalue.rs +++ b/src/sitrvalue.rs @@ -51,7 +51,7 @@ struct SitArray {} impl Situation for SitArray { fn whatnow(&mut self, horizon: &[u8], is_horizon_lengthenable: bool) -> ParseResult { for (i, _) in horizon.iter().enumerate() { - if let Some(res) = common_no_cmd(b')' as u16, horizon, i, is_horizon_lengthenable) { + if let Some(res) = common_no_cmd(u16::from(b')'), horizon, i, is_horizon_lengthenable) { return res; } } diff --git a/src/sitstrphantom.rs b/src/sitstrphantom.rs index a119056..e618a48 100644 --- a/src/sitstrphantom.rs +++ b/src/sitstrphantom.rs @@ -31,7 +31,7 @@ impl Situation for SitStrPhantom { if is_horizon_lengthenable { return Ok(flush(0)); } - } else if horizon[mouthful] as u16 != self.cmd_end_trigger { + } else if u16::from(horizon[mouthful]) != self.cmd_end_trigger { match horizon[mouthful] { b'\"' => { return Ok(WhatNow{