chore: fix clippy warnings

This commit is contained in:
Dmitriy Pleshevskiy 2021-07-12 16:16:50 +03:00
parent c2b2e4fd67
commit 2baa8dba87
2 changed files with 3 additions and 3 deletions

View file

@ -55,7 +55,7 @@ pub enum ChannelMode {
impl ChannelMode { impl ChannelMode {
/// Converts enum to &str /// Converts enum to &str
pub fn to_str(&self) -> &str { pub fn as_str(&self) -> &str {
match self { match self {
#[cfg(feature = "search")] #[cfg(feature = "search")]
ChannelMode::Search => "search", ChannelMode::Search => "search",
@ -71,7 +71,7 @@ impl ChannelMode {
impl fmt::Display for ChannelMode { impl fmt::Display for ChannelMode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::result::Result<(), fmt::Error> {
write!(f, "{}", self.to_str()) write!(f, "{}", self.as_str())
} }
} }

View file

@ -39,7 +39,7 @@ impl StreamCommand for StartCommand {
} }
if let Some(caps) = RE.captures(&message) { if let Some(caps) = RE.captures(&message) {
if self.mode.to_str() != &caps["mode"] { if self.mode.as_str() != &caps["mode"] {
Err(Error::new(ErrorKind::SwitchMode)) Err(Error::new(ErrorKind::SwitchMode))
} else { } else {
let protocol_version: usize = let protocol_version: usize =