From 9c415f9c9e433101564767603e0be7aa341c7343 Mon Sep 17 00:00:00 2001 From: Gwenael Treguier Date: Sun, 2 Aug 2015 12:16:01 +0200 Subject: [PATCH] Remove usage of unstable library feature 'duration' --- src/lib.rs | 1 - src/trace.rs | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3c03fef..4dfd068 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,7 +50,6 @@ //! } //! } //! ``` -#![cfg_attr(test, feature(duration))] extern crate libc; extern crate libsqlite3_sys as ffi; #[macro_use] extern crate bitflags; diff --git a/src/trace.rs b/src/trace.rs index cde1d75..de03742 100644 --- a/src/trace.rs +++ b/src/trace.rs @@ -80,19 +80,17 @@ mod test { super::config_log(None).unwrap(); } - extern "C" fn profile_callback(_: *mut ::libc::c_void, sql: *const ::libc::c_char, nanoseconds: u64) { - use std::time::Duration; + extern "C" fn trace_callback(_: *mut ::libc::c_void, sql: *const ::libc::c_char) { unsafe { let c_slice = ::std::ffi::CStr::from_ptr(sql).to_bytes(); - let d = Duration::from_millis(nanoseconds / 1_000_000); - let _ = writeln!(::std::io::stderr(), "PROFILE: {:?} ({})", ::std::str::from_utf8(c_slice), d); + let _ = writeln!(::std::io::stderr(), "TRACE: {:?}", ::std::str::from_utf8(c_slice)); } } #[test] - fn test_profile() { + fn test_trace() { let mut db = SqliteConnection::open_in_memory().unwrap(); - db.profile(Some(profile_callback)); + db.trace(Some(trace_callback)); db.execute_batch("PRAGMA application_id = 1").unwrap(); } } \ No newline at end of file