summaryrefslogtreecommitdiff
path: root/src/callbacks.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-10-25 11:20:13 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-10-25 11:20:13 +0200
commitd91b029e768c8bfe410df1add69ac24811b52958 (patch)
treeabb98a91bc5e5e0072a7ce3e866b640f41d24351 /src/callbacks.rs
parentba38ac07dc702e7d734ec648fdb8d552c03c1458 (diff)
fix(style): run cargo clippymain
Diffstat (limited to 'src/callbacks.rs')
-rw-r--r--src/callbacks.rs28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs
index 8b4e846..c3bcb03 100644
--- a/src/callbacks.rs
+++ b/src/callbacks.rs
@@ -9,9 +9,9 @@ use teloxide::{
/// Handle the string of callback data
pub async fn handler(
cx: &UpdateWithCx<AutoSend<Bot>, CallbackQuery>,
- text: &String,
+ text: &str,
) -> Result<bool, Box<dyn Error + Send + Sync>> {
- let call: Vec<&str> = text.split("_").collect();
+ let call: Vec<&str> = text.split('_').collect();
let chat_id = call[0];
// First part of `_` string is the type of callback we want to handle
@@ -39,14 +39,12 @@ pub async fn handler(
.reply_markup(keyboard)
.await?;
- return Ok(true);
+ Ok(true)
} else {
- return Ok(false);
+ Ok(false)
}
}
- Err(_) => {
- return Ok(false);
- }
+ Err(_) => Ok(false),
}
},
"space" => unsafe {
@@ -81,14 +79,12 @@ pub async fn handler(
.reply_markup(keyboard)
.await?;
- return Ok(true);
+ Ok(true)
} else {
- return Ok(false);
+ Ok(false)
}
}
- Err(_) => {
- return Ok(false);
- }
+ Err(_) => Ok(false),
}
},
"timetable" => unsafe {
@@ -102,7 +98,7 @@ pub async fn handler(
"Reservation made! ✅",
)
.await?;
- return Ok(true);
+ Ok(true)
} else {
cx.requester
.edit_message_text(
@@ -111,12 +107,10 @@ pub async fn handler(
"Error, try again! ⚠️",
)
.await?;
- return Ok(false);
+ Ok(false)
}
}
- Err(_) => {
- return Ok(false);
- }
+ Err(_) => Ok(false),
}
},
_ => Ok(false),