[librsvg/fix-lifetime-warnings: 3/3] Replace explicit lifetimes with anonymous ones where possible
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/fix-lifetime-warnings: 3/3] Replace explicit lifetimes with anonymous ones where possible
- Date: Thu, 28 Jan 2021 02:38:52 +0000 (UTC)
commit d24da6798f2d9a6d14e561db348b7549099def82
Author: Sven Neumann <sven svenfoo org>
Date: Wed Jan 27 11:18:41 2021 +0100
Replace explicit lifetimes with anonymous ones where possible
Here the lifetime is only specified because it is needed by type declaration,
so an anonymous lifetime can be used instead.
https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
src/filters/component_transfer.rs | 2 +-
src/parsers.rs | 2 +-
src/path_builder.rs | 14 +++++++-------
3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/filters/component_transfer.rs b/src/filters/component_transfer.rs
index 280cc63b..2d073ea7 100644
--- a/src/filters/component_transfer.rs
+++ b/src/filters/component_transfer.rs
@@ -330,7 +330,7 @@ impl FilterEffect for FeComponentTransfer {
let func_a = func_or_default!(func_a_node, FeFuncA, func_a_element, func_a_default);
#[inline]
- fn compute_func<'a, F>(func: &'a F) -> impl Fn(u8, f64, f64) -> u8 + 'a
+ fn compute_func<F>(func: &F) -> impl Fn(u8, f64, f64) -> u8 + '_
where
F: FeComponentTransferFunc,
{
diff --git a/src/parsers.rs b/src/parsers.rs
index 6b138149..59c8dc6e 100644
--- a/src/parsers.rs
+++ b/src/parsers.rs
@@ -29,7 +29,7 @@ pub trait Parse: Sized {
}
/// Consumes a comma if it exists, or does nothing.
-pub fn optional_comma<'i, 't>(parser: &mut Parser<'i, 't>) {
+pub fn optional_comma(parser: &mut Parser<'_, '_>) {
let _ = parser.try_parse(|p| p.expect_comma());
}
diff --git a/src/path_builder.rs b/src/path_builder.rs
index 56eb8688..0c74bb3f 100644
--- a/src/path_builder.rs
+++ b/src/path_builder.rs
@@ -34,7 +34,7 @@ impl CubicBezierCurve {
cr.curve_to(pt1.0, pt1.1, pt2.0, pt2.1, to.0, to.1);
}
- fn from_coords<'a>(coords: &mut slice::Iter<'a, f64>) -> CubicBezierCurve {
+ fn from_coords(coords: &mut slice::Iter<'_, f64>) -> CubicBezierCurve {
let pt1 = take_two(coords);
let pt2 = take_two(coords);
let to = take_two(coords);
@@ -245,10 +245,10 @@ impl EllipticalArc {
}
}
- fn from_coords<'a>(
+ fn from_coords(
large_arc: LargeArc,
sweep: Sweep,
- coords: &mut slice::Iter<'a, f64>,
+ coords: &mut slice::Iter<'_, f64>,
) -> EllipticalArc {
let r = take_two(coords);
let x_axis_rotation = take_one(coords);
@@ -385,7 +385,7 @@ impl PathCommand {
}
}
- fn from_packed<'a>(packed: PackedCommand, coords: &mut slice::Iter<'a, f64>) -> PathCommand {
+ fn from_packed(packed: PackedCommand, coords: &mut slice::Iter<'_, f64>) -> PathCommand {
match packed {
PackedCommand::MoveTo => {
let x = take_one(coords);
@@ -623,7 +623,7 @@ impl Path {
}
}
- pub fn iter<'a>(&'a self) -> impl Iterator<Item = PathCommand> + 'a {
+ pub fn iter(&self) -> impl Iterator<Item = PathCommand> + '_ {
let commands = self.commands.iter();
let mut coords = self.coords.iter();
@@ -690,11 +690,11 @@ impl Path {
}
}
-fn take_one<'a>(iter: &mut slice::Iter<'a, f64>) -> f64 {
+fn take_one(iter: &mut slice::Iter<'_, f64>) -> f64 {
*iter.next().unwrap()
}
-fn take_two<'a>(iter: &mut slice::Iter<'a, f64>) -> (f64, f64) {
+fn take_two(iter: &mut slice::Iter<'_, f64>) -> (f64, f64) {
(take_one(iter), take_one(iter))
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]