Skip to content

Commit

Permalink
Merge pull request #232 from therealprof/clippy-lints
Browse files Browse the repository at this point in the history
Fix some clippy lints
  • Loading branch information
hannobraun authored Feb 21, 2022
2 parents d07ab74 + c87c1cd commit d1b186b
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/config_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl ConfigUi {
// - @hannobraun
&mut StagingBelt::new(1024),
encoder,
&view,
view,
surface_config.width,
surface_config.height,
)?;
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/pipelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 2 additions & 5 deletions src/graphics/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/input/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/kernel/topology/faces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/math/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d1b186b

Please sign in to comment.