Upgrade to 2018

This commit is contained in:
Andrey Tkachenko 2020-04-28 21:32:07 +04:00
parent 863e23c869
commit 09606936ad
6 changed files with 22 additions and 20 deletions

View File

@ -7,17 +7,19 @@ keywords = ["tree", "dimension" , "nearest", "search", "neighbor"]
readme = "README.md" readme = "README.md"
license = "Unlicense" license = "Unlicense"
description = "K-dimensional tree implemented in Rust for fast NN querying." description = "K-dimensional tree implemented in Rust for fast NN querying."
edition = "2018"
[lib] [lib]
name = "kdtree" name = "kdtree"
path = "src//lib.rs" path = "src/lib.rs"
bench = false bench = false
[[bench]] [[bench]]
name = "bench" name = "bench"
path = "src/bench.rs"
harness = false harness = false
[dev-dependencies] [dev-dependencies]
quickcheck = "~0.3" quickcheck = "~0.9"
rand = "~0.3.12" rand = "~0.7"
bencher = "~0.1.2" bencher = "~0.1"

View File

@ -1,4 +1,5 @@
#[macro_use] extern crate bencher; #[macro_use]
extern crate bencher;
extern crate kdtree; extern crate kdtree;
extern crate rand; extern crate rand;

View File

@ -1,4 +1,5 @@
use ::kdtree::*; use crate::kdtree::KdTreePoint;
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct Bounds { pub struct Bounds {
@ -91,8 +92,8 @@ impl Bounds {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::Bounds;
use ::kdtree::test_common::*; use crate::kdtree::test_common::Point2WithId;
#[test] #[test]
fn bounds_test() { fn bounds_test() {

View File

@ -311,7 +311,7 @@ impl<T: KdTreePoint> KdTreeNode<T> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use ::kdtree::test_common::Point2WithId; use crate::kdtree::test_common::Point2WithId;
use super::*; use super::*;

View File

@ -1,4 +1,4 @@
use ::kdtree::*; use crate::kdtree::KdTreePoint;
enum PointsWereOnSide { enum PointsWereOnSide {
Left, Left,
@ -125,14 +125,9 @@ fn partition_kdtree<T: KdTreePoint>(vec: &mut [T], index_of_splitting_point: usi
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use ::kdtree::*;
use ::kdtree::test_common::*;
use ::rand::distributions::{IndependentSample, Range};
use ::rand::*;
use super::*; use super::*;
use super::partition_kdtree; use crate::kdtree::test_common::{Point1WithId, Point2WithId};
use rand::Rng;
#[test] #[test]
fn parition_kdtree_works() { fn parition_kdtree_works() {
@ -166,11 +161,11 @@ mod tests {
if xs.len() == 0 { if xs.len() == 0 {
return true; return true;
} }
let between = Range::new(0, xs.len());
let mut rng = thread_rng(); let mut rng = rand::thread_rng();
for _ in 0 .. 5 { for _ in 0 .. 5 {
let random_splitting_index = between.ind_sample(&mut rng); let random_splitting_index = rng.gen_range(0, xs.len());
let mut vec = vec.clone(); let mut vec = vec.clone();

View File

@ -6,3 +6,6 @@ extern crate quickcheck;
extern crate rand; extern crate rand;
pub mod kdtree; pub mod kdtree;
#[cfg(test)]
mod bench;