Skip to content

Commit d0ff026

Browse files
committed
Replace Captures trick with the new use keyword
1 parent 209ea6b commit d0ff026

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

libraries/raw-rs/src/demosaicing/linear_demosaicing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{Captures, Pixel, RawImage};
1+
use crate::{Pixel, RawImage};
22

33
fn average(data: &[u16], indexes: impl Iterator<Item = i64>) -> u16 {
44
let mut sum = 0;
@@ -14,14 +14,14 @@ fn average(data: &[u16], indexes: impl Iterator<Item = i64>) -> u16 {
1414
}
1515

1616
impl RawImage {
17-
pub fn linear_demosaic_iter(&self) -> impl Iterator<Item = Pixel> + Captures<&'_ ()> {
17+
pub fn linear_demosaic_iter(&self) -> impl Iterator<Item = Pixel> + use<'_> {
1818
match self.cfa_pattern {
1919
[0, 1, 1, 2] => self.linear_demosaic_rggb_iter(),
2020
_ => todo!(),
2121
}
2222
}
2323

24-
fn linear_demosaic_rggb_iter(&self) -> impl Iterator<Item = Pixel> + Captures<&'_ ()> {
24+
fn linear_demosaic_rggb_iter(&self) -> impl Iterator<Item = Pixel> + use<'_> {
2525
let width = self.width as i64;
2626
let height = self.height as i64;
2727

libraries/raw-rs/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,3 @@ pub enum DecoderError {
200200
#[error("An IO Error ocurred")]
201201
IoError(#[from] std::io::Error),
202202
}
203-
204-
// This trait is here only to circumvent Rust's lifetime capturing rules in return type impl Trait.
205-
// See https://youtu.be/CWiz_RtA1Hw?si=j0si4qE2Y20f71Uo
206-
// This should be removed when Rust 2024 edition is released as described in https://blog.rust-lang.org/2024/09/05/impl-trait-capture-rules.html
207-
pub trait Captures<U> {}
208-
impl<T: ?Sized, U> Captures<U> for T {}

libraries/raw-rs/src/postprocessing/transform.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::{Captures, Image, Pixel, Transform};
1+
use crate::{Image, Pixel, Transform};
22

33
impl Image<u16> {
4-
pub fn transform_iter(&self) -> (usize, usize, impl Iterator<Item = Pixel> + Captures<&'_ ()>) {
4+
pub fn transform_iter(&self) -> (usize, usize, impl Iterator<Item = Pixel> + use<'_>) {
55
let (final_width, final_height) = if self.transform.will_swap_coordinates() {
66
(self.height, self.width)
77
} else {

0 commit comments

Comments
 (0)