Remove unnecessary Option<>

Add missing comment, fix typo
This commit is contained in:
Agatha 2020-03-29 19:11:10 +03:00
parent dc0a7824c0
commit 1a6dd19c01
1 changed files with 6 additions and 9 deletions

View File

@ -164,11 +164,11 @@ fn embed(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
#[derive(Deserialize)] #[derive(Deserialize)]
struct EmbedProperties { struct EmbedProperties {
author: Option<(String, Option<String>)>, author: Option<(String, String)>,
colour: String, colour: String,
description: Option<String>, description: Option<String>,
fields: Option<Vec<(String, String, bool)>>, fields: Option<Vec<(String, String, bool)>>,
footer: Option<(String, Option<String>)>, footer: Option<(String, String)>,
image: Option<String>, image: Option<String>,
timestamp: Option<String>, timestamp: Option<String>,
title: Option<String>, title: Option<String>,
@ -194,11 +194,9 @@ fn embed(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
if input_embed.author != None { if input_embed.author != None {
let auth = input_embed.author.unwrap(); let auth = input_embed.author.unwrap();
e.author(|a| { e.author(|a| {
//assumin first array element is name and second is icon url //assuming first array element is name and second is icon url
a.name(auth.0); a.name(auth.0);
if auth.1 != None { a.icon_url(auth.1);
a.icon_url(auth.1.unwrap());
}
a a
}); });
@ -222,10 +220,9 @@ fn embed(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
if input_embed.footer != None { if input_embed.footer != None {
let foot = input_embed.footer.unwrap(); let foot = input_embed.footer.unwrap();
e.footer(|f| { e.footer(|f| {
//assuming first array element is name and second is icon url
f.text(foot.0); f.text(foot.0);
if foot.1 != None { f.icon_url(foot.1);
f.icon_url(foot.1.unwrap());
}
f f
}); });