diff --git a/Cargo.toml b/Cargo.toml index a19f5399a..712ca2571 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ atomicwrites = {version="0.2.2", optional=true} tempfile = "3.0" log = "0.4" combine = ">=3.6.0,<4.0.0" -tempdir = "0.3" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" @@ -36,7 +35,7 @@ levenshtein_automata = {version="0.1", features=["fst_automaton"]} notify = {version="4", optional=true} bit-set = "0.5" uuid = { version = "0.7.2", features = ["v4", "serde"] } -crossbeam = "0.5" +crossbeam = "0.7" futures = "0.1" futures-cpupool = "0.1" owning_ref = "0.4" diff --git a/examples/basic_search.rs b/examples/basic_search.rs index 416f86f35..2715114ba 100644 --- a/examples/basic_search.rs +++ b/examples/basic_search.rs @@ -19,12 +19,12 @@ use tantivy::query::QueryParser; use tantivy::schema::*; use tantivy::Index; use tantivy::ReloadPolicy; -use tempdir::TempDir; +use tempfile::TempDir; fn main() -> tantivy::Result<()> { // Let's create a temporary directory for the // sake of this example - let index_path = TempDir::new("tantivy_example_dir")?; + let index_path = TempDir::new()?; // # Defining the schema // diff --git a/examples/faceted_search.rs b/examples/faceted_search.rs index 98e0a2753..094777479 100644 --- a/examples/faceted_search.rs +++ b/examples/faceted_search.rs @@ -18,11 +18,12 @@ use tantivy::collector::FacetCollector; use tantivy::query::AllQuery; use tantivy::schema::*; use tantivy::Index; +use tempfile::TempDir; fn main() -> tantivy::Result<()> { // Let's create a temporary directory for the // sake of this example - let index_path = TempDir::new("tantivy_facet_example_dir")?; + let index_path = TempDir::new()?; let mut schema_builder = Schema::builder(); schema_builder.add_text_field("name", TEXT | STORED); @@ -75,4 +76,3 @@ fn main() -> tantivy::Result<()> { Ok(()) } -use tempdir::TempDir; diff --git a/examples/snippet.rs b/examples/snippet.rs index 0d87834ea..054d7607a 100644 --- a/examples/snippet.rs +++ b/examples/snippet.rs @@ -14,12 +14,12 @@ use tantivy::query::QueryParser; use tantivy::schema::*; use tantivy::Index; use tantivy::{Snippet, SnippetGenerator}; -use tempdir::TempDir; +use tempfile::TempDir; fn main() -> tantivy::Result<()> { // Let's create a temporary directory for the // sake of this example - let index_path = TempDir::new("tantivy_example_dir")?; + let index_path = TempDir::new()?; // # Defining the schema let mut schema_builder = Schema::builder(); diff --git a/src/collector/top_score_collector.rs b/src/collector/top_score_collector.rs index 21a88be19..64ebe59e1 100644 --- a/src/collector/top_score_collector.rs +++ b/src/collector/top_score_collector.rs @@ -591,7 +591,7 @@ mod tests { query_field: Field, schema: Schema, mut doc_adder: impl FnMut(&mut IndexWriter) -> (), - ) -> (Index, Box) { + ) -> (Index, Box) { let index = Index::create_in_ram(schema); let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap(); diff --git a/src/core/index.rs b/src/core/index.rs index c3def313e..1abe07dff 100644 --- a/src/core/index.rs +++ b/src/core/index.rs @@ -459,13 +459,13 @@ mod tests { use super::*; use std::path::PathBuf; - use tempdir::TempDir; + use tempfile::TempDir; #[test] fn test_index_on_commit_reload_policy_mmap() { let schema = throw_away_schema(); let field = schema.get_field("num_likes").unwrap(); - let tempdir = TempDir::new("index").unwrap(); + let tempdir = TempDir::new().unwrap(); let tempdir_path = PathBuf::from(tempdir.path()); let index = Index::create_in_dir(&tempdir_path, schema).unwrap(); let mut writer = index.writer_with_num_threads(1, 3_000_000).unwrap(); @@ -504,7 +504,7 @@ mod tests { fn test_index_on_commit_reload_policy_different_directories() { let schema = throw_away_schema(); let field = schema.get_field("num_likes").unwrap(); - let tempdir = TempDir::new("index").unwrap(); + let tempdir = TempDir::new().unwrap(); let tempdir_path = PathBuf::from(tempdir.path()); let write_index = Index::create_in_dir(&tempdir_path, schema).unwrap(); let read_index = Index::open_in_dir(&tempdir_path).unwrap(); diff --git a/src/directory/managed_directory.rs b/src/directory/managed_directory.rs index c33ff1b46..859e66d51 100644 --- a/src/directory/managed_directory.rs +++ b/src/directory/managed_directory.rs @@ -263,11 +263,11 @@ mod tests_mmap_specific { use std::collections::HashSet; use std::io::Write; use std::path::{Path, PathBuf}; - use tempdir::TempDir; + use tempfile::TempDir; #[test] fn test_managed_directory() { - let tempdir = TempDir::new("tantivy-test").unwrap(); + let tempdir = TempDir::new().unwrap(); let tempdir_path = PathBuf::from(tempdir.path()); let test_path1: &'static Path = Path::new("some_path_for_test"); @@ -304,7 +304,7 @@ mod tests_mmap_specific { fn test_managed_directory_gc_while_mmapped() { let test_path1: &'static Path = Path::new("some_path_for_test"); - let tempdir = TempDir::new("index").unwrap(); + let tempdir = TempDir::new().unwrap(); let tempdir_path = PathBuf::from(tempdir.path()); let living_files = HashSet::new(); diff --git a/src/directory/mmap_directory.rs b/src/directory/mmap_directory.rs index afe90b85f..4b1bc0355 100644 --- a/src/directory/mmap_directory.rs +++ b/src/directory/mmap_directory.rs @@ -36,7 +36,7 @@ use std::sync::Mutex; use std::sync::RwLock; use std::sync::Weak; use std::thread; -use tempdir::TempDir; +use tempfile::TempDir; /// Create a default io error given a string. pub(crate) fn make_io_err(msg: String) -> io::Error { @@ -294,7 +294,7 @@ impl MmapDirectory { /// This is mostly useful to test the MmapDirectory itself. /// For your unit tests, prefer the RAMDirectory. pub fn create_from_tempdir() -> Result { - let tempdir = TempDir::new("index").map_err(OpenDirectoryError::IoError)?; + let tempdir = TempDir::new().map_err(OpenDirectoryError::IoError)?; let tempdir_path = PathBuf::from(tempdir.path()); MmapDirectory::new(tempdir_path, Some(tempdir)) } @@ -642,7 +642,7 @@ mod tests { fn test_watch_wrapper() { let counter: Arc = Default::default(); let counter_clone = counter.clone(); - let tmp_dir: TempDir = tempdir::TempDir::new("test_watch_wrapper").unwrap(); + let tmp_dir = tempfile::TempDir::new().unwrap(); let tmp_dirpath = tmp_dir.path().to_owned(); let mut watch_wrapper = WatcherWrapper::new(&tmp_dirpath).unwrap(); let tmp_file = tmp_dirpath.join("coucou"); diff --git a/src/indexer/index_writer.rs b/src/indexer/index_writer.rs index fa5ae0b5e..5210281d3 100644 --- a/src/indexer/index_writer.rs +++ b/src/indexer/index_writer.rs @@ -761,7 +761,6 @@ mod tests { use crate::Index; use crate::ReloadPolicy; use crate::Term; - use fail; #[test] fn test_operations_group() { diff --git a/src/lib.rs b/src/lib.rs index 9947a2cfe..44683bf90 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ //! //! ```rust -//! # extern crate tempdir; +//! # extern crate tempfile; //! # //! #[macro_use] //! extern crate tantivy; @@ -20,7 +20,7 @@ //! // ... //! //! # use std::path::Path; -//! # use tempdir::TempDir; +//! # use tempfile::TempDir; //! # use tantivy::Index; //! # use tantivy::schema::*; //! # use tantivy::{Score, DocAddress}; @@ -30,7 +30,7 @@ //! # fn main() { //! # // Let's create a temporary directory for the //! # // sake of this example -//! # if let Ok(dir) = TempDir::new("tantivy_example_dir") { +//! # if let Ok(dir) = TempDir::new() { //! # run_example(dir.path()).unwrap(); //! # dir.close().unwrap(); //! # } diff --git a/tests/failpoints/mod.rs b/tests/failpoints/mod.rs index f8360b36f..807ca7abc 100644 --- a/tests/failpoints/mod.rs +++ b/tests/failpoints/mod.rs @@ -8,7 +8,7 @@ use tantivy::{Index, Term}; #[test] fn test_failpoints_managed_directory_gc_if_delete_fails() { - let scenario = fail::FailScenario::setup(); + let _scenario = fail::FailScenario::setup(); let test_path: &'static Path = Path::new("some_path_for_test");