Fix doctest when feature can be changed.

This commit is contained in:
kennytm 2017-05-18 22:21:31 +08:00
parent 200ebf40d6
commit 0e1c1fe1f6
2 changed files with 5 additions and 1 deletions

View file

@ -39,7 +39,7 @@ install:
script: script:
- cargo test --no-default-features - cargo test --no-default-features
- cargo test - cargo test
- if [ "$TRAVIS_RUST_VERSION" = 'nightly' ]; then cargo bench; fi - if [ "$TRAVIS_RUST_VERSION" = 'nightly' ]; then cargo bench --features=bench; fi
after_success: after_success:
- cargo install cargo-kcov - cargo install cargo-kcov

View file

@ -4,9 +4,11 @@
//! //!
//! ``` //! ```
//! extern crate qrcode; //! extern crate qrcode;
//! # #[cfg(feature="image")]
//! extern crate image; //! extern crate image;
//! //!
//! use qrcode::QrCode; //! use qrcode::QrCode;
//! # #[cfg(feature="image")]
//! use image::GrayImage; //! use image::GrayImage;
//! //!
//! fn main() { //! fn main() {
@ -14,9 +16,11 @@
//! let code = QrCode::new(b"01234567").unwrap(); //! let code = QrCode::new(b"01234567").unwrap();
//! //!
//! // Render the bits into an image. //! // Render the bits into an image.
//! # #[cfg(feature="image")]
//! let image: GrayImage = code.render().to_image(); //! let image: GrayImage = code.render().to_image();
//! //!
//! // Save the image. //! // Save the image.
//! # #[cfg(feature="image")]
//! image.save("/tmp/qrcode.png").unwrap(); //! image.save("/tmp/qrcode.png").unwrap();
//! } //! }
//! ``` //! ```