diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs')
-rw-r--r-- | src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs deleted file mode 100644 index f3f44433c..000000000 --- a/src/test/ui/closures/2229_closure_analysis/run_pass/tuple-struct-pattern-matching-with-methods.rs +++ /dev/null @@ -1,43 +0,0 @@ -// edition:2021 -//check-pass - -#[derive(Copy, Clone)] -enum PointType { - TwoD(u32, u32), - ThreeD(u32, u32, u32) -} - -// Testing tuple struct patterns -struct Points { - points: Vec<PointType>, -} - -impl Points { - pub fn test1(&mut self) -> Vec<usize> { - (0..self.points.len()) - .filter_map(|i| { - match self.test2(i) { - PointType::TwoD (..) => Some(i), - PointType::ThreeD (..) => None, - } - }) - .collect() - } - - pub fn test2(&mut self, i: usize) -> PointType { - self.points[i] - } -} - -fn main() { - let mut points = Points { - points: Vec::<PointType>::new() - }; - - points.points.push(PointType::ThreeD(0,0,0)); - points.points.push(PointType::TwoD(0,0)); - points.points.push(PointType::ThreeD(0,0,1)); - points.points.push(PointType::TwoD(0,1)); - - println!("{:?}", points.test1()); -} |