Merge pull request #232 from therealprof/clippy-lints

Fix some clippy lints
This commit is contained in:
Hanno Braun 2022-02-21 20:17:24 +01:00 committed by GitHub
commit d1b186b983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 14 deletions

View File

@ -132,7 +132,7 @@ impl Camera {
&self,
window: &Window,
cursor: Option<PhysicalPosition<f64>>,
triangles: &Vec<Triangle>,
triangles: &[Triangle],
) -> FocusPoint {
let cursor = match cursor {
Some(cursor) => cursor,

View File

@ -88,7 +88,7 @@ impl ConfigUi {
// - @hannobraun
&mut StagingBelt::new(1024),
encoder,
&view,
view,
surface_config.width,
surface_config.height,
)?;

View File

@ -87,7 +87,7 @@ impl Pipeline {
front_face: wgpu::FrontFace::Ccw,
cull_mode: None,
unclipped_depth: false,
polygon_mode: polygon_mode,
polygon_mode,
conservative: false,
},
depth_stencil: Some(wgpu::DepthStencilState {

View File

@ -175,7 +175,6 @@ impl Renderer {
let uniforms = Uniforms {
transform: Transform::for_vertices(camera, aspect_ratio),
transform_normals: Transform::for_normals(camera),
..Uniforms::default()
};
self.queue.write_buffer(
@ -231,7 +230,7 @@ impl Renderer {
&self.geometries.aabb,
config,
)
.map_err(|err| DrawError::Text(err))?;
.map_err(DrawError::Text)?;
let command_buffer = encoder.finish();
self.queue.submit(Some(command_buffer));
@ -261,9 +260,7 @@ impl Renderer {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
});
let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
view
texture.create_view(&wgpu::TextureViewDescriptor::default())
}
fn clear_views(

View File

@ -121,7 +121,7 @@ impl Handler {
now: Instant,
camera: &mut Camera,
window: &Window,
triangles: &Vec<Triangle>,
triangles: &[Triangle],
) {
let focus_point = camera.focus_point(window, self.cursor, triangles);

View File

@ -103,7 +103,7 @@ impl Face {
) {
match self {
Self::Face { edges, surface } => {
let approx = Approximation::for_edges(&edges, tolerance);
let approx = Approximation::for_edges(edges, tolerance);
approx.validate().expect("Invalid approximation");
let points: Vec<_> = approx
@ -195,7 +195,7 @@ impl Face {
let intersection = edge
.to_parry()
.cast_local_ray(&ray, f64::INFINITY, true)
.map(|t| Scalar::from_f64(t));
.map(Scalar::from_f64);
if let Some(t) = intersection {
// Due to slight inaccuracies, we might get

View File

@ -41,7 +41,7 @@ fn main() -> anyhow::Result<()> {
let mut parameters = HashMap::new();
for parameter in args.parameters {
let mut parameter = parameter.splitn(2, "=");
let mut parameter = parameter.splitn(2, '=');
let key = parameter
.next()

View File

@ -123,7 +123,7 @@ impl Ord for Scalar {
fn cmp(&self, other: &Self) -> cmp::Ordering {
// Should never panic, as `from_f64` checks that the wrapped value is
// finite.
self.partial_cmp(&other).unwrap()
self.partial_cmp(other).unwrap()
}
}

View File

@ -70,7 +70,7 @@ impl Model {
let shape = unsafe {
let lib = libloading::Library::new(self.lib_path())?;
let model: libloading::Symbol<ModelFn> = lib.get(b"model")?;
model(&arguments)
model(arguments)
};
Ok(shape)