From 398fa15f151f01cc2ec5af0ce0729ea70f755724 Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Tue, 15 Nov 2022 17:48:06 +0800 Subject: [PATCH] make compiler warnings go away --- cozo-core/src/runtime/db.rs | 9 +++++---- cozo-core/src/storage/mem.rs | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cozo-core/src/runtime/db.rs b/cozo-core/src/runtime/db.rs index ff595d37..0dc66fd2 100644 --- a/cozo-core/src/runtime/db.rs +++ b/cozo-core/src/runtime/db.rs @@ -26,7 +26,6 @@ use thiserror::Error; use crate::data::json::JsonValue; use crate::data::program::{InputProgram, QueryAssertion, RelationOp}; -use crate::data::symb::Symbol; use crate::data::tuple::Tuple; use crate::data::value::{DataValue, LARGEST_UTF_CHAR}; use crate::parse::sys::SysOp; @@ -785,10 +784,12 @@ impl Poison { } Ok(()) } - pub(crate) fn set_timeout(&self, secs: f64) -> Result<()> { - #[cfg(feature = "nothread")] + #[cfg(feature = "nothread")] + pub(crate) fn set_timeout(&self, _secs: f64) -> Result<()> { bail!("Cannot set timeout when threading is disallowed"); - + } + #[cfg(not(feature = "nothread"))] + pub(crate) fn set_timeout(&self, secs: f64) -> Result<()> { let pill = self.0.clone(); thread::spawn(move || { thread::sleep(Duration::from_micros((secs * 1000000.) as u64)); diff --git a/cozo-core/src/storage/mem.rs b/cozo-core/src/storage/mem.rs index 7458e04a..455439c4 100644 --- a/cozo-core/src/storage/mem.rs +++ b/cozo-core/src/storage/mem.rs @@ -11,8 +11,8 @@ use std::collections::btree_map::Range; use std::collections::BTreeMap; use std::default::Default; use std::iter::Fuse; +use std::mem; use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard}; -use std::{mem, thread}; use itertools::Itertools; use miette::{bail, Result}; @@ -70,7 +70,7 @@ impl<'s> Storage<'s> for MemStorage { #[cfg(feature = "nothread")] closure(); #[cfg(not(feature = "nothread"))] - thread::spawn(closure); + std::thread::spawn(closure); Ok(()) }