Skip to content

Commit

Permalink
Remove unnecessary main() wrapper from doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Jan 11, 2021
1 parent c4b1120 commit 5597f65
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,29 @@
//!
//! use rustc_version::{version, version_meta, Channel, Version};
//!
//! fn main() {
//! // Assert we haven't travelled back in time
//! assert!(version().unwrap().major >= 1);
//! // Assert we haven't travelled back in time
//! assert!(version().unwrap().major >= 1);
//!
//! // Set cfg flags depending on release channel
//! match version_meta().unwrap().channel {
//! Channel::Stable => {
//! println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
//! }
//! Channel::Beta => {
//! println!("cargo:rustc-cfg=RUSTC_IS_BETA");
//! }
//! Channel::Nightly => {
//! println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY");
//! }
//! Channel::Dev => {
//! println!("cargo:rustc-cfg=RUSTC_IS_DEV");
//! }
//! // Set cfg flags depending on release channel
//! match version_meta().unwrap().channel {
//! Channel::Stable => {
//! println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
//! }
//!
//! // Check for a minimum version
//! if version().unwrap() >= Version::parse("1.4.0").unwrap() {
//! println!("cargo:rustc-cfg=compiler_has_important_bugfix");
//! Channel::Beta => {
//! println!("cargo:rustc-cfg=RUSTC_IS_BETA");
//! }
//! Channel::Nightly => {
//! println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY");
//! }
//! Channel::Dev => {
//! println!("cargo:rustc-cfg=RUSTC_IS_DEV");
//! }
//! }
//!
//! // Check for a minimum version
//! if version().unwrap() >= Version::parse("1.4.0").unwrap() {
//! println!("cargo:rustc-cfg=compiler_has_important_bugfix");
//! }
//! ```

#[cfg(test)]
Expand Down

0 comments on commit 5597f65

Please sign in to comment.