Skip to content

Commit 6f5d40a

Browse files
author
Matthew Russo
committed
fix clippy errors
1 parent 3acc7ac commit 6f5d40a

21 files changed

+77
-92
lines changed

Diff for: src/bin/00_base_code.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ impl HelloTriangleApplication {
3333
loop {
3434
let mut done = false;
3535
self.events_loop.poll_events(|ev| {
36-
match ev {
37-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
38-
_ => ()
36+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
37+
done = true
3938
}
4039
});
4140
if done {

Diff for: src/bin/01_instance_creation.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ impl HelloTriangleApplication {
6464
loop {
6565
let mut done = false;
6666
self.events_loop.poll_events(|ev| {
67-
match ev {
68-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
69-
_ => ()
67+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
68+
done = true
7069
}
7170
});
7271
if done {

Diff for: src/bin/02_validation_layers.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl HelloTriangleApplication {
7878
let required_extensions = Self::get_required_extensions();
7979

8080
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
81-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
81+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
8282
.expect("failed to create Vulkan instance")
8383
} else {
8484
Instance::new(Some(&app_info), &required_extensions, None)
@@ -124,9 +124,8 @@ impl HelloTriangleApplication {
124124
loop {
125125
let mut done = false;
126126
self.events_loop.poll_events(|ev| {
127-
match ev {
128-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
129-
_ => ()
127+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
128+
done = true
130129
}
131130
});
132131
if done {

Diff for: src/bin/03_physical_device_selection.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl HelloTriangleApplication {
9898
let required_extensions = Self::get_required_extensions();
9999

100100
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
101-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
101+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
102102
.expect("failed to create Vulkan instance")
103103
} else {
104104
Instance::new(Some(&app_info), &required_extensions, None)
@@ -171,9 +171,8 @@ impl HelloTriangleApplication {
171171
loop {
172172
let mut done = false;
173173
self.events_loop.poll_events(|ev| {
174-
match ev {
175-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
176-
_ => ()
174+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
175+
done = true
177176
}
178177
});
179178
if done {

Diff for: src/bin/04_logical_device.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl HelloTriangleApplication {
107107
let required_extensions = Self::get_required_extensions();
108108

109109
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
110-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
110+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
111111
.expect("failed to create Vulkan instance")
112112
} else {
113113
Instance::new(Some(&app_info), &required_extensions, None)
@@ -205,9 +205,8 @@ impl HelloTriangleApplication {
205205
loop {
206206
let mut done = false;
207207
self.events_loop.poll_events(|ev| {
208-
match ev {
209-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
210-
_ => ()
208+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
209+
done = true
211210
}
212211
});
213212
if done {

Diff for: src/bin/05_window_surface.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl HelloTriangleApplication {
107107
let required_extensions = Self::get_required_extensions();
108108

109109
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
110-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
110+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
111111
.expect("failed to create Vulkan instance")
112112
} else {
113113
Instance::new(Some(&app_info), &required_extensions, None)
@@ -225,9 +225,8 @@ impl HelloTriangleApplication {
225225
loop {
226226
let mut done = false;
227227
self.events_loop.poll_events(|ev| {
228-
match ev {
229-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
230-
_ => ()
228+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
229+
done = true
231230
}
232231
});
233232
if done {

Diff for: src/bin/06_swap_chain_creation.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl HelloTriangleApplication {
133133
let required_extensions = Self::get_required_extensions();
134134

135135
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
136-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
136+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
137137
.expect("failed to create Vulkan instance")
138138
} else {
139139
Instance::new(Some(&app_info), &required_extensions, None)
@@ -354,9 +354,8 @@ impl HelloTriangleApplication {
354354
loop {
355355
let mut done = false;
356356
self.events_loop.poll_events(|ev| {
357-
match ev {
358-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
359-
_ => ()
357+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
358+
done = true
360359
}
361360
});
362361
if done {

Diff for: src/bin/08_graphics_pipeline.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl HelloTriangleApplication {
135135
let required_extensions = Self::get_required_extensions();
136136

137137
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
138-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
138+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
139139
.expect("failed to create Vulkan instance")
140140
} else {
141141
Instance::new(Some(&app_info), &required_extensions, None)
@@ -360,9 +360,8 @@ impl HelloTriangleApplication {
360360
loop {
361361
let mut done = false;
362362
self.events_loop.poll_events(|ev| {
363-
match ev {
364-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
365-
_ => ()
363+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
364+
done = true
366365
}
367366
});
368367
if done {

Diff for: src/bin/09_shader_modules.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl HelloTriangleApplication {
135135
let required_extensions = Self::get_required_extensions();
136136

137137
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
138-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
138+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
139139
.expect("failed to create Vulkan instance")
140140
} else {
141141
Instance::new(Some(&app_info), &required_extensions, None)
@@ -379,9 +379,8 @@ impl HelloTriangleApplication {
379379
loop {
380380
let mut done = false;
381381
self.events_loop.poll_events(|ev| {
382-
match ev {
383-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
384-
_ => ()
382+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
383+
done = true
385384
}
386385
});
387386
if done {

Diff for: src/bin/10_fixed_functions.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl HelloTriangleApplication {
140140
let required_extensions = Self::get_required_extensions();
141141

142142
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
143-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
143+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
144144
.expect("failed to create Vulkan instance")
145145
} else {
146146
Instance::new(Some(&app_info), &required_extensions, None)
@@ -409,9 +409,8 @@ impl HelloTriangleApplication {
409409
loop {
410410
let mut done = false;
411411
self.events_loop.poll_events(|ev| {
412-
match ev {
413-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
414-
_ => ()
412+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
413+
done = true
415414
}
416415
});
417416
if done {

Diff for: src/bin/11_render_passes.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl HelloTriangleApplication {
149149
let required_extensions = Self::get_required_extensions();
150150

151151
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
152-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
152+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
153153
.expect("failed to create Vulkan instance")
154154
} else {
155155
Instance::new(Some(&app_info), &required_extensions, None)
@@ -435,9 +435,8 @@ impl HelloTriangleApplication {
435435
loop {
436436
let mut done = false;
437437
self.events_loop.poll_events(|ev| {
438-
match ev {
439-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
440-
_ => ()
438+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
439+
done = true
441440
}
442441
});
443442
if done {

Diff for: src/bin/12_graphics_pipeline_complete.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl HelloTriangleApplication {
159159
let required_extensions = Self::get_required_extensions();
160160

161161
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
162-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
162+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
163163
.expect("failed to create Vulkan instance")
164164
} else {
165165
Instance::new(Some(&app_info), &required_extensions, None)
@@ -449,9 +449,8 @@ impl HelloTriangleApplication {
449449
loop {
450450
let mut done = false;
451451
self.events_loop.poll_events(|ev| {
452-
match ev {
453-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
454-
_ => ()
452+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
453+
done = true
455454
}
456455
});
457456
if done {

Diff for: src/bin/13_framebuffers.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl HelloTriangleApplication {
167167
let required_extensions = Self::get_required_extensions();
168168

169169
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
170-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
170+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
171171
.expect("failed to create Vulkan instance")
172172
} else {
173173
Instance::new(Some(&app_info), &required_extensions, None)
@@ -392,7 +392,7 @@ impl HelloTriangleApplication {
392392
}
393393

394394
fn create_framebuffers(
395-
swap_chain_images: &Vec<Arc<SwapchainImage<Window>>>,
395+
swap_chain_images: &[Arc<SwapchainImage<Window>>],
396396
render_pass: &Arc<RenderPassAbstract + Send + Sync>
397397
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
398398
swap_chain_images.iter()
@@ -471,9 +471,8 @@ impl HelloTriangleApplication {
471471
loop {
472472
let mut done = false;
473473
self.events_loop.poll_events(|ev| {
474-
match ev {
475-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
476-
_ => ()
474+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
475+
done = true
477476
}
478477
});
479478
if done {

Diff for: src/bin/14_command_buffers.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl HelloTriangleApplication {
180180
let required_extensions = Self::get_required_extensions();
181181

182182
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
183-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
183+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
184184
.expect("failed to create Vulkan instance")
185185
} else {
186186
Instance::new(Some(&app_info), &required_extensions, None)
@@ -405,7 +405,7 @@ impl HelloTriangleApplication {
405405
}
406406

407407
fn create_framebuffers(
408-
swap_chain_images: &Vec<Arc<SwapchainImage<Window>>>,
408+
swap_chain_images: &[Arc<SwapchainImage<Window>>],
409409
render_pass: &Arc<RenderPassAbstract + Send + Sync>
410410
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
411411
swap_chain_images.iter()
@@ -504,9 +504,8 @@ impl HelloTriangleApplication {
504504
loop {
505505
let mut done = false;
506506
self.events_loop.poll_events(|ev| {
507-
match ev {
508-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
509-
_ => ()
507+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
508+
done = true
510509
}
511510
});
512511
if done {

Diff for: src/bin/15_hello_triangle.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl HelloTriangleApplication {
181181
let required_extensions = Self::get_required_extensions();
182182

183183
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
184-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
184+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
185185
.expect("failed to create Vulkan instance")
186186
} else {
187187
Instance::new(Some(&app_info), &required_extensions, None)
@@ -406,7 +406,7 @@ impl HelloTriangleApplication {
406406
}
407407

408408
fn create_framebuffers(
409-
swap_chain_images: &Vec<Arc<SwapchainImage<Window>>>,
409+
swap_chain_images: &[Arc<SwapchainImage<Window>>],
410410
render_pass: &Arc<RenderPassAbstract + Send + Sync>
411411
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
412412
swap_chain_images.iter()
@@ -507,9 +507,8 @@ impl HelloTriangleApplication {
507507

508508
let mut done = false;
509509
self.events_loop.poll_events(|ev| {
510-
match ev {
511-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
512-
_ => ()
510+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
511+
done = true
513512
}
514513
});
515514
if done {

Diff for: src/bin/16_swap_chain_recreation.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl HelloTriangleApplication {
190190
let required_extensions = Self::get_required_extensions();
191191

192192
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
193-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
193+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
194194
.expect("failed to create Vulkan instance")
195195
} else {
196196
Instance::new(Some(&app_info), &required_extensions, None)
@@ -416,7 +416,7 @@ impl HelloTriangleApplication {
416416
}
417417

418418
fn create_framebuffers(
419-
swap_chain_images: &Vec<Arc<SwapchainImage<Window>>>,
419+
swap_chain_images: &[Arc<SwapchainImage<Window>>],
420420
render_pass: &Arc<RenderPassAbstract + Send + Sync>
421421
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
422422
swap_chain_images.iter()
@@ -521,9 +521,8 @@ impl HelloTriangleApplication {
521521

522522
let mut done = false;
523523
self.events_loop.poll_events(|ev| {
524-
match ev {
525-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
526-
_ => ()
524+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
525+
done = true
527526
}
528527
});
529528
if done {

Diff for: src/bin/18_vertex_buffer.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl HelloTriangleApplication {
211211
let required_extensions = Self::get_required_extensions();
212212

213213
if ENABLE_VALIDATION_LAYERS && Self::check_validation_layer_support() {
214-
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().map(|s| *s))
214+
Instance::new(Some(&app_info), &required_extensions, VALIDATION_LAYERS.iter().cloned())
215215
.expect("failed to create Vulkan instance")
216216
} else {
217217
Instance::new(Some(&app_info), &required_extensions, None)
@@ -437,7 +437,7 @@ impl HelloTriangleApplication {
437437
}
438438

439439
fn create_framebuffers(
440-
swap_chain_images: &Vec<Arc<SwapchainImage<Window>>>,
440+
swap_chain_images: &[Arc<SwapchainImage<Window>>],
441441
render_pass: &Arc<RenderPassAbstract + Send + Sync>
442442
) -> Vec<Arc<FramebufferAbstract + Send + Sync>> {
443443
swap_chain_images.iter()
@@ -546,9 +546,8 @@ impl HelloTriangleApplication {
546546

547547
let mut done = false;
548548
self.events_loop.poll_events(|ev| {
549-
match ev {
550-
Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => done = true,
551-
_ => ()
549+
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = ev {
550+
done = true
552551
}
553552
});
554553
if done {

0 commit comments

Comments
 (0)