fcd05ed99f
This commit deprecates the entire libtime library in favor of the externally-provided libtime in the rust-lang organization. Users of the `libtime` crate as-is today should add this to their Cargo manifests: [dependencies.time] git = "https://github.com/rust-lang/time" To implement this transition, a new function `Duration::span` was added to the `std::time::Duration` time. This function takes a closure and then returns the duration of time it took that closure to execute. This interface will likely improve with `FnOnce` unboxed closures as moving in and out will be a little easier. Due to the deprecation of the in-tree crate, this is a: [breaking-change] cc #18855, some of the conversions in the `src/test/bench` area may have been a little nicer with that implemented
35 lines
1.0 KiB
Rust
35 lines
1.0 KiB
Rust
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
// aux-build:lint-unused-extern-crate.rs
|
|
|
|
#![feature(globs)]
|
|
#![deny(unused_extern_crates)]
|
|
#![allow(unused_variables)]
|
|
|
|
extern crate libc; //~ ERROR: unused extern crate
|
|
|
|
extern crate "collections" as collecs; // no error, it is used
|
|
|
|
extern crate rand; // no error, the use marks it as used
|
|
// even if imported objects aren't used
|
|
|
|
extern crate "lint-unused-extern-crate" as other; // no error, the use * marks it as used
|
|
|
|
#[allow(unused_imports)]
|
|
use rand::isaac::IsaacRng;
|
|
|
|
use other::*;
|
|
|
|
fn main() {
|
|
let x: collecs::vec::Vec<uint> = Vec::new();
|
|
let y = foo();
|
|
}
|