Skip to content

Commit 2e3e575

Browse files
committed
Fix the feature masks in the approx_sqrt doc example
The hidden "mod test" layout of the first example has been broken for a while, but it wasn't noticed because rustdoc wasn't passing any features at all. That was fixed in rust-lang/rust#30372, and now we need to get our ducks in a row too.
1 parent 477cbc8 commit 2e3e575

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
//! ```
2323
//! extern crate num;
2424
//! # #[cfg(all(feature = "bigint", feature="rational"))]
25-
//! # pub mod test {
25+
//! # mod test {
2626
//!
2727
//! use num::FromPrimitive;
2828
//! use num::bigint::BigInt;
2929
//! use num::rational::{Ratio, BigRational};
3030
//!
31+
//! # pub
3132
//! fn approx_sqrt(number: u64, iterations: usize) -> BigRational {
3233
//! let start: Ratio<BigInt> = Ratio::from_integer(FromPrimitive::from_u64(number).unwrap());
3334
//! let mut approx = start.clone();
@@ -41,7 +42,8 @@
4142
//! }
4243
//! # }
4344
//! # #[cfg(not(all(feature = "bigint", feature="rational")))]
44-
//! # fn approx_sqrt(n: u64, _: usize) -> u64 { n }
45+
//! # mod test { pub fn approx_sqrt(n: u64, _: usize) -> u64 { n } }
46+
//! # use test::approx_sqrt;
4547
//!
4648
//! fn main() {
4749
//! println!("{}", approx_sqrt(10, 4)); // prints 4057691201/1283082416

0 commit comments

Comments
 (0)