[clippy 9/15] as u16 → u16::from
This commit is contained in:
parent
31ecf3a9f8
commit
6fc711eef8
@ -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<ParseResult> {
|
||||
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
|
||||
}));
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user