Restrict SlackHeaderBlock to accept plan text only block (#273)

* Restrict SlackHeaderBlock to accept plan text only block

* Fix new cargo clippy warnings
This commit is contained in:
Abdulla Abdurakhmanov 2024-05-15 21:42:46 +02:00 committed by GitHub
parent e1ab878f7b
commit b03c088742
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 20 additions and 7 deletions

View file

@ -87,10 +87,7 @@ pub struct SlackApiFilesUploadResponse {
pub file: SlackFile,
}
fn to_csv<S: Serializer>(x: &Option<Vec<SlackChannelId>>, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
fn to_csv<S: Serializer>(x: &Option<Vec<SlackChannelId>>, s: S) -> Result<S::Ok, S::Error> {
match x {
None => s.serialize_none(),
Some(ids) => {

View file

@ -13,6 +13,7 @@ pub enum SlackDateTimeFormats {
TimeSecs,
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackDateTimeFormats {
fn to_string(&self) -> String {
match self {

View file

@ -56,7 +56,7 @@ impl From<SlackSectionBlock> for SlackBlock {
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackHeaderBlock {
pub block_id: Option<SlackBlockId>,
pub text: SlackBlockText,
pub text: SlackBlockPlainTextOnly,
}
impl From<SlackHeaderBlock> for SlackBlock {
@ -874,8 +874,8 @@ impl From<SlackBlockCheckboxesElement> for SlackActionBlockElement {
}
/**
* 'plain_text' type of https://api.slack.com/reference/block-kit/composition-objects#text
*/
* 'plain_text' type of https://api.slack.com/reference/block-kit/composition-objects#text
*/
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)]
pub struct SlackBlockPlainText {

View file

@ -9,23 +9,35 @@ use std::*;
use url::Url;
mod user;
pub use user::*;
mod team;
pub use team::*;
mod channel;
pub use channel::*;
mod reaction;
pub use reaction::*;
mod star;
pub use star::*;
mod bot;
pub use bot::*;
mod icon;
pub use icon::*;
mod formatters;
pub use formatters::*;
#[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)]
@ -178,6 +190,7 @@ pub enum SlackConversationType {
Public,
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackConversationType {
fn to_string(&self) -> String {
match self {

View file

@ -24,6 +24,7 @@ impl SlackSocketModeWssClientId {
}
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackSocketModeWssClientId {
fn to_string(&self) -> String {
format!(

View file

@ -24,6 +24,7 @@ pub enum SlackApiTokenType {
App,
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for SlackApiTokenType {
fn to_string(&self) -> String {
match self {