Replace '!= None' with '.is_some()'
This commit is contained in:
parent
0b006bf9fa
commit
768bc1549f
16
src/main.rs
16
src/main.rs
|
@ -210,7 +210,7 @@ fn embed(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
|
|||
let _ = message.channel_id.send_message(&ctx.http, |m| {
|
||||
m.embed(|e| {
|
||||
// Set embed author unless empty
|
||||
if input_embed.author != None {
|
||||
if input_embed.author.is_some() {
|
||||
let auth = input_embed.author.unwrap();
|
||||
e.author(|a| {
|
||||
//assuming first array element is name and second is icon url
|
||||
|
@ -230,16 +230,16 @@ fn embed(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
|
|||
}
|
||||
|
||||
// Set embed description unless empty
|
||||
if input_embed.description != None {
|
||||
if input_embed.description.is_some() {
|
||||
e.description(input_embed.description.unwrap());
|
||||
}
|
||||
// Set embed fields unless empty
|
||||
if input_embed.fields != None {
|
||||
if input_embed.fields.is_some() {
|
||||
e.fields(input_embed.fields.unwrap());
|
||||
}
|
||||
|
||||
// Set embed footer unless empty
|
||||
if input_embed.footer != None {
|
||||
if input_embed.footer.is_some() {
|
||||
let foot = input_embed.footer.unwrap();
|
||||
e.footer(|f| {
|
||||
//assuming first array element is name and second is icon url
|
||||
|
@ -250,19 +250,19 @@ fn embed(ctx: &mut Context, message: &Message, args: Args) -> CommandResult {
|
|||
});
|
||||
}
|
||||
|
||||
if input_embed.image != None {
|
||||
if input_embed.image.is_some() {
|
||||
e.image(input_embed.image.unwrap());
|
||||
}
|
||||
|
||||
if input_embed.timestamp != None {
|
||||
if input_embed.timestamp.is_some() {
|
||||
e.timestamp(input_embed.timestamp.unwrap());
|
||||
}
|
||||
|
||||
if input_embed.title != None {
|
||||
if input_embed.title.is_some() {
|
||||
e.title(input_embed.title.unwrap());
|
||||
}
|
||||
|
||||
if input_embed.url != None {
|
||||
if input_embed.url.is_some() {
|
||||
e.url(input_embed.url.unwrap());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue