Skip to content

Commit

Permalink
Convert from macro to ? (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiW authored and arqunis committed Nov 23, 2017
1 parent 4e20277 commit 2d23d8b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/framework/standard/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl Args {
let mut vec = Vec::with_capacity(i as usize);

for _ in 0..i {
vec.push(try_opt!(self.delimiter_split.shift()));
vec.push(self.delimiter_split.shift()?);
}

Some(vec)
Expand Down
8 changes: 0 additions & 8 deletions src/internal/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,3 @@ macro_rules! enum_number {
}
}
}

#[allow(unused_macros)]
macro_rules! try_opt {
($x:expr) => (match $x {
Some(v) => v,
None => return None,
});
}
2 changes: 1 addition & 1 deletion src/model/guild/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Member {
#[cfg(all(feature = "cache", feature = "utils"))]
pub fn colour(&self) -> Option<Colour> {
let cache = CACHE.read();
let guild = try_opt!(cache.guilds.get(&self.guild_id)).read();
let guild = cache.guilds.get(&self.guild_id)?.read();

let mut roles = self.roles
.iter()
Expand Down

0 comments on commit 2d23d8b

Please sign in to comment.