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.
This commit is contained in:
parent
477cbc87c9
commit
2e3e575117
|
@ -22,12 +22,13 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! extern crate num;
|
//! extern crate num;
|
||||||
//! # #[cfg(all(feature = "bigint", feature="rational"))]
|
//! # #[cfg(all(feature = "bigint", feature="rational"))]
|
||||||
//! # pub mod test {
|
//! # mod test {
|
||||||
//!
|
//!
|
||||||
//! use num::FromPrimitive;
|
//! use num::FromPrimitive;
|
||||||
//! use num::bigint::BigInt;
|
//! use num::bigint::BigInt;
|
||||||
//! use num::rational::{Ratio, BigRational};
|
//! use num::rational::{Ratio, BigRational};
|
||||||
//!
|
//!
|
||||||
|
//! # pub
|
||||||
//! fn approx_sqrt(number: u64, iterations: usize) -> BigRational {
|
//! fn approx_sqrt(number: u64, iterations: usize) -> BigRational {
|
||||||
//! let start: Ratio<BigInt> = Ratio::from_integer(FromPrimitive::from_u64(number).unwrap());
|
//! let start: Ratio<BigInt> = Ratio::from_integer(FromPrimitive::from_u64(number).unwrap());
|
||||||
//! let mut approx = start.clone();
|
//! let mut approx = start.clone();
|
||||||
|
@ -41,7 +42,8 @@
|
||||||
//! }
|
//! }
|
||||||
//! # }
|
//! # }
|
||||||
//! # #[cfg(not(all(feature = "bigint", feature="rational")))]
|
//! # #[cfg(not(all(feature = "bigint", feature="rational")))]
|
||||||
//! # fn approx_sqrt(n: u64, _: usize) -> u64 { n }
|
//! # mod test { pub fn approx_sqrt(n: u64, _: usize) -> u64 { n } }
|
||||||
|
//! # use test::approx_sqrt;
|
||||||
//!
|
//!
|
||||||
//! fn main() {
|
//! fn main() {
|
||||||
//! println!("{}", approx_sqrt(10, 4)); // prints 4057691201/1283082416
|
//! println!("{}", approx_sqrt(10, 4)); // prints 4057691201/1283082416
|
||||||
|
|
Loading…
Reference in New Issue