Skip to content

Commit 5597f65

Browse files
committed
Remove unnecessary main() wrapper from doctest
1 parent c4b1120 commit 5597f65

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/lib.rs

+19-21
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,29 @@
2424
//!
2525
//! use rustc_version::{version, version_meta, Channel, Version};
2626
//!
27-
//! fn main() {
28-
//! // Assert we haven't travelled back in time
29-
//! assert!(version().unwrap().major >= 1);
27+
//! // Assert we haven't travelled back in time
28+
//! assert!(version().unwrap().major >= 1);
3029
//!
31-
//! // Set cfg flags depending on release channel
32-
//! match version_meta().unwrap().channel {
33-
//! Channel::Stable => {
34-
//! println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
35-
//! }
36-
//! Channel::Beta => {
37-
//! println!("cargo:rustc-cfg=RUSTC_IS_BETA");
38-
//! }
39-
//! Channel::Nightly => {
40-
//! println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY");
41-
//! }
42-
//! Channel::Dev => {
43-
//! println!("cargo:rustc-cfg=RUSTC_IS_DEV");
44-
//! }
30+
//! // Set cfg flags depending on release channel
31+
//! match version_meta().unwrap().channel {
32+
//! Channel::Stable => {
33+
//! println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
4534
//! }
46-
//!
47-
//! // Check for a minimum version
48-
//! if version().unwrap() >= Version::parse("1.4.0").unwrap() {
49-
//! println!("cargo:rustc-cfg=compiler_has_important_bugfix");
35+
//! Channel::Beta => {
36+
//! println!("cargo:rustc-cfg=RUSTC_IS_BETA");
37+
//! }
38+
//! Channel::Nightly => {
39+
//! println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY");
40+
//! }
41+
//! Channel::Dev => {
42+
//! println!("cargo:rustc-cfg=RUSTC_IS_DEV");
5043
//! }
5144
//! }
45+
//!
46+
//! // Check for a minimum version
47+
//! if version().unwrap() >= Version::parse("1.4.0").unwrap() {
48+
//! println!("cargo:rustc-cfg=compiler_has_important_bugfix");
49+
//! }
5250
//! ```
5351
5452
#[cfg(test)]

0 commit comments

Comments
 (0)