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"
license = "Unlicense"
description = "K-dimensional tree implemented in Rust for fast NN querying."
edition = "2018"
[lib]
name = "kdtree"
path = "src//lib.rs"
path = "src/lib.rs"
bench = false
[[bench]]
name = "bench"
path = "src/bench.rs"
harness = false
[dev-dependencies]
quickcheck = "~0.3"
rand = "~0.3.12"
bencher = "~0.1.2"
quickcheck = "~0.9"
rand = "~0.7"
bencher = "~0.1"

View File

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

View File

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

View File

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

View File

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

View File

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