summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-10-21 14:00:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2021-10-21 14:00:45 -0400
commitbf2a10ca3b54ac3ed3dcc9c25cb1cf7f07ba8135 (patch)
tree632db87bfa81c29575dfdb7834b44c0226a34248
parent09e55694247f1a9494374e99574cc65bace706e7 (diff)
downloadacap-bf2a10ca3b54ac3ed3dcc9c25cb1cf7f07ba8135.tar.xz
Add explicit '_ lifetimes to generic types
-rw-r--r--src/exhaustive.rs2
-rw-r--r--src/kd.rs4
-rw-r--r--src/lib.rs2
-rw-r--r--src/vp.rs16
4 files changed, 13 insertions, 11 deletions
diff --git a/src/exhaustive.rs b/src/exhaustive.rs
index 23a490f..3f42876 100644
--- a/src/exhaustive.rs
+++ b/src/exhaustive.rs
@@ -16,7 +16,7 @@ impl<T> ExhaustiveSearch<T> {
}
/// Iterate over the items stored in this index.
- pub fn iter(&self) -> Iter<T> {
+ pub fn iter(&self) -> Iter<'_, T> {
self.into_iter()
}
diff --git a/src/kd.rs b/src/kd.rs
index 332cabd..3c3699a 100644
--- a/src/kd.rs
+++ b/src/kd.rs
@@ -185,7 +185,7 @@ impl<T: Coordinates> KdTree<T> {
}
/// Iterate over the items stored in this tree.
- pub fn iter(&self) -> Iter<T> {
+ pub fn iter(&self) -> Iter<'_, T> {
self.into_iter()
}
@@ -456,7 +456,7 @@ impl<T: Coordinates> FlatKdTree<T> {
}
/// Iterate over the items stored in this tree.
- pub fn iter(&self) -> FlatIter<T> {
+ pub fn iter(&self) -> FlatIter<'_, T> {
self.into_iter()
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 1e77f6b..29d351a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -122,6 +122,8 @@
//! [`k_nearest_within()`]: knn::NearestNeighbors#method.k_nearest_within
//! [`ExactNeighbors`]: knn::ExactNeighbors
+#![warn(rust_2018_idioms)]
+
pub mod chebyshev;
pub mod coords;
pub mod cos;
diff --git a/src/vp.rs b/src/vp.rs
index 3e1a8ad..4417b6b 100644
--- a/src/vp.rs
+++ b/src/vp.rs
@@ -197,7 +197,7 @@ impl<T: Proximity> VpTree<T> {
}
/// Iterate over the items stored in this tree.
- pub fn iter(&self) -> Iter<T> {
+ pub fn iter(&self) -> Iter<'_, T> {
self.into_iter()
}
@@ -246,7 +246,7 @@ where
T: Proximity + Debug,
DistanceValue<T>: Debug,
{
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("VpTree")
.field("root", &self.root)
.finish()
@@ -295,7 +295,7 @@ where
T: Proximity + Debug,
DistanceValue<T>: Debug,
{
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("IntoIter")
.field("stack", &self.stack)
.finish()
@@ -345,7 +345,7 @@ where
T: Proximity + Debug,
DistanceValue<T>: Debug,
{
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("Iter")
.field("stack", &self.stack)
.finish()
@@ -504,7 +504,7 @@ impl<T: Proximity> FlatVpTree<T> {
}
/// Iterate over the items stored in this tree.
- pub fn iter(&self) -> FlatIter<T> {
+ pub fn iter(&self) -> FlatIter<'_, T> {
self.into_iter()
}
}
@@ -514,7 +514,7 @@ where
T: Proximity + Debug,
DistanceValue<T>: Debug,
{
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_struct("FlatVpTree")
.field("nodes", &self.nodes)
.finish()
@@ -535,7 +535,7 @@ where
T: Proximity + Debug,
DistanceValue<T>: Debug,
{
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_tuple("FlatIntoIter")
.field(&self.0)
.finish()
@@ -567,7 +567,7 @@ where
T: Proximity + Debug,
DistanceValue<T>: Debug,
{
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.debug_tuple("FlatIter")
.field(&self.0)
.finish()