From 69247ad12ee865892399e839d2be225260d24f2d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 17 Jan 2020 15:01:09 -0800 Subject: [PATCH] Assume const fn support --- Cargo.toml | 4 ---- build.rs | 12 ------------ src/lib.rs | 9 --------- 3 files changed, 25 deletions(-) delete mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index 2a583f9..21c7cd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ name = "num-complex" repository = "https://github.com/rust-num/num-complex" version = "0.3.0-pre" readme = "README.md" -build = "build.rs" exclude = ["/ci/*", "/.travis.yml", "/bors.toml"] publish = false @@ -37,6 +36,3 @@ default-features = false [features] default = ["std"] std = ["num-traits/std"] - -[build-dependencies] -autocfg = "1" diff --git a/build.rs b/build.rs deleted file mode 100644 index 60d24cb..0000000 --- a/build.rs +++ /dev/null @@ -1,12 +0,0 @@ -extern crate autocfg; - -fn main() { - let ac = autocfg::new(); - - // autocfg doesn't have a direct way to probe for `const fn` yet. - if ac.probe_rustc_version(1, 31) { - autocfg::emit("has_const_fn"); - } - - autocfg::rerun_path("build.rs"); -} diff --git a/src/lib.rs b/src/lib.rs index 1b8f4ce..5f69183 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,19 +93,11 @@ pub type Complex32 = Complex; pub type Complex64 = Complex; impl Complex { - #[cfg(has_const_fn)] /// Create a new Complex #[inline] pub const fn new(re: T, im: T) -> Self { Complex { re: re, im: im } } - - #[cfg(not(has_const_fn))] - /// Create a new Complex - #[inline] - pub fn new(re: T, im: T) -> Self { - Complex { re: re, im: im } - } } impl Complex { @@ -2647,7 +2639,6 @@ mod test { assert!(c.is_one()); } - #[cfg(has_const_fn)] #[test] fn test_const() { const R: f64 = 12.3;