diff options
| author | Austin Hellyer <[email protected]> | 2016-11-19 08:48:58 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-19 08:48:58 -0800 |
| commit | 7f24c706b36e8815c1d4f47de5257466cc281571 (patch) | |
| tree | 064653c56fc42d7fdac963120c4206b4151caa76 /src/client/context.rs | |
| parent | Don't send embed on message edits if empty (diff) | |
| download | serenity-7f24c706b36e8815c1d4f47de5257466cc281571.tar.xz serenity-7f24c706b36e8815c1d4f47de5257466cc281571.zip | |
Fix cond. compile across multiple feature targets
Fixes conditional compilation across multiple combinations of feature
targets, where it was assumed a second feature would be enabled by
something that requires a feature to be enabled.
This also fixes an EOF compilation error on no-feature builds.
Diffstat (limited to 'src/client/context.rs')
| -rw-r--r-- | src/client/context.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/client/context.rs b/src/client/context.rs index 9103e3a..cd3468f 100644 --- a/src/client/context.rs +++ b/src/client/context.rs @@ -757,7 +757,7 @@ impl Context { let guild_id = guild_id.into(); let role_id = role_id.into(); - let map = feature_state! {{ + feature_state! {{ let state = STATE.lock().unwrap(); let role = if let Some(role) = { @@ -768,12 +768,14 @@ impl Context { return Err(Error::Client(ClientError::RecordNotFound)); }; - f(EditRole::new(role)).0.build() + let map = f(EditRole::new(role)).0.build(); + + return http::edit_role(guild_id.0, role_id.0, map); } else { - f(EditRole::default()).0.build() - }}; + let map = f(EditRole::default()).0.build(); - http::edit_role(guild_id.0, role_id.0, map) + return http::edit_role(guild_id.0, role_id.0, map); + }} } /// Edit a message given its Id and the Id of the channel it belongs to. @@ -1233,11 +1235,15 @@ impl Context { /// [`OnlineStatus`]: ../model/enum.OnlineStatus.html /// [`Playing`]: ../model/enum.GameType.html#variant.Playing pub fn set_game_name(&self, game: Option<&str>) { + let game = game.map(|x| Game { + kind: GameType::Playing, + name: x.to_owned(), + url: None, + }); + self.connection.lock() .unwrap() - .set_presence(game.map(|x| Game::playing(x.to_owned())), - OnlineStatus::Online, - false); + .set_presence(game, OnlineStatus::Online, false); } pub fn set_presence(&self, |