diff options
| author | Zeyla Hellyer <[email protected]> | 2018-08-07 09:24:07 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-08-07 09:25:06 -0700 |
| commit | 39bb75cc6759ceb972c0caca0b03c7971a445eb8 (patch) | |
| tree | 343d97399ea597804f0cd30016034c4adb8efebe /src/lib.rs | |
| parent | Fix some documentation spacing (diff) | |
| download | serenity-39bb75cc6759ceb972c0caca0b03c7971a445eb8.tar.xz serenity-39bb75cc6759ceb972c0caca0b03c7971a445eb8.zip | |
Fix compilation + tests on certain feature combos
On certain feature combinations, compilation and tests would not function
correctly.
This commit goes through a number of feature combinations and gates some tests
behind the required features and fixes other compilation errors.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -32,8 +32,10 @@ //! ```rust,no_run //! #[macro_use] extern crate serenity; //! -//! use serenity::client::Client; -//! use serenity::prelude::EventHandler; +//! # #[cfg(all(feature = "client", feature = "standard_framework"))] +//! # mod inner { +//! # +//! use serenity::client::{Client, EventHandler}; //! use serenity::framework::standard::StandardFramework; //! use std::env; //! @@ -45,6 +47,7 @@ //! // Login with a bot token from the environment //! let mut client = Client::new(&env::var("DISCORD_TOKEN").expect("token"), Handler) //! .expect("Error creating client"); +//! //! client.with_framework(StandardFramework::new() //! .configure(|c| c.prefix("~")) // set the bot's prefix to "~" //! .cmd("ping", ping)); @@ -58,6 +61,13 @@ //! command!(ping(_context, message) { //! let _ = message.reply("Pong!"); //! }); +//! # +//! # } +//! # +//! # #[cfg(all(feature = "client", feature = "standard_framework"))] +//! # fn main() { inner::main() } +//! # #[cfg(not(all(feature = "client", feature = "standard_framework")))] +//! # fn main() {} //! ``` //! //! ### Full Examples @@ -100,10 +110,12 @@ #[macro_use] extern crate bitflags; +#[allow(unused_imports)] #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; +#[allow(unused_imports)] #[macro_use] extern crate serde_json; @@ -140,6 +152,7 @@ extern crate typemap; #[cfg(feature = "evzht9h3nznqzwl")] extern crate evzht9h3nznqzwl as websocket; +#[allow(unused_imports)] #[cfg(test)] #[macro_use] extern crate matches; |