mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Fix Clippy
This commit is contained in:
parent
99c7bf5955
commit
ab8dae9213
5 changed files with 9 additions and 7 deletions
|
@ -280,6 +280,7 @@ where
|
|||
UpdateKind::Poll(poll) => {
|
||||
self.handle(&self.poll_handler, poll).await
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -106,6 +106,7 @@ impl<'a> SendPoll<'a> {
|
|||
}
|
||||
|
||||
/// `true`, if the poll needs to be anonymous, defaults to `true`.
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_anonymous<T>(mut self, val: T) -> Self
|
||||
where
|
||||
T: Into<bool>,
|
||||
|
@ -145,6 +146,7 @@ impl<'a> SendPoll<'a> {
|
|||
/// Pass `true`, if the poll needs to be immediately closed.
|
||||
///
|
||||
/// This can be useful for poll preview.
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_closed<T>(mut self, val: T) -> Self
|
||||
where
|
||||
T: Into<bool>,
|
||||
|
|
|
@ -47,7 +47,7 @@ fn parse_attrs(attrs: &[Attr]) -> Result<CommandAttrs, String> {
|
|||
BotCommandAttribute::Description => description = Some(attr.value()),
|
||||
BotCommandAttribute::RenameRule => rename_rule = Some(attr.value()),
|
||||
#[allow(unreachable_patterns)]
|
||||
_ => return Err(format!("unexpected attribute")),
|
||||
_ => return Err("unexpected attribute".to_owned()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ impl CommandEnum {
|
|||
if let Some(rename_rule) = &rename {
|
||||
match rename_rule.as_str() {
|
||||
"lowercase" => {},
|
||||
_ => return Err(format!("unallowed value")),
|
||||
_ => return Err("disallowed value".to_owned()),
|
||||
}
|
||||
}
|
||||
Ok(Self {
|
||||
|
@ -44,7 +44,7 @@ fn parse_attrs(attrs: &[Attr]) -> Result<CommandAttrs, String> {
|
|||
BotCommandAttribute::Description => description = Some(attr.value()),
|
||||
BotCommandAttribute::RenameRule => rename_rule = Some(attr.value()),
|
||||
#[allow(unreachable_patterns)]
|
||||
_ => return Err(format!("unexpected attribute")),
|
||||
_ => return Err("unexpected attribute".to_owned()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ pub fn derive_telegram_command_enum(tokens: TokenStream) -> TokenStream {
|
|||
});
|
||||
let variant_str1 = variant_prefixes.zip(variant_name).map(|(prefix, command)| prefix.to_string() + command.as_str());
|
||||
let variant_str2 = variant_str1.clone();
|
||||
let variant_description = variant_infos.iter().map(|info| info.description.as_ref().map(String::as_str).unwrap_or(""));
|
||||
let variant_description = variant_infos.iter().map(|info| info.description.as_deref().unwrap_or(""));
|
||||
|
||||
let ident = &input.ident;
|
||||
|
||||
|
@ -114,8 +114,7 @@ pub fn derive_telegram_command_enum(tokens: TokenStream) -> TokenStream {
|
|||
};
|
||||
//for debug
|
||||
//println!("{}", &expanded.to_string());
|
||||
let tokens = TokenStream::from(expanded);
|
||||
tokens
|
||||
TokenStream::from(expanded)
|
||||
}
|
||||
|
||||
fn get_enum_data(input: &DeriveInput) -> Result<&syn::DataEnum, TokenStream> {
|
||||
|
@ -125,7 +124,7 @@ fn get_enum_data(input: &DeriveInput) -> Result<&syn::DataEnum, TokenStream> {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_attributes(input: &Vec<syn::Attribute>) -> Result<Vec<Attr>, TokenStream> {
|
||||
fn parse_attributes(input: &[syn::Attribute]) -> Result<Vec<Attr>, TokenStream> {
|
||||
let mut enum_attrs = Vec::new();
|
||||
for attr in input.iter() {
|
||||
match attr.parse_args::<VecAttrs>() {
|
||||
|
|
Loading…
Add table
Reference in a new issue