From cd8793e55c0031be8f302ff5dec905087807d2ff Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Sat, 30 Dec 2023 04:41:54 -0500 Subject: [PATCH] clippy warnings --- backend/src/main.rs | 2 +- backend/src/state/game.rs | 2 +- triangle/src/lib.rs | 19 ++++++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/backend/src/main.rs b/backend/src/main.rs index d3e002e..baded14 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -2,7 +2,7 @@ extern crate serde_json; mod generate; -#[allow(unused_imports, dead_code)] +#[allow(unused_imports, dead_code, clippy::all)] pub mod prisma; mod routes; pub mod state; diff --git a/backend/src/state/game.rs b/backend/src/state/game.rs index ab3567a..8098858 100644 --- a/backend/src/state/game.rs +++ b/backend/src/state/game.rs @@ -20,7 +20,7 @@ pub struct GameCoreState { } pub struct GameDerivedState<'a> { - core: &'a GameCoreState, + pub core: &'a GameCoreState, } impl GameCoreState { diff --git a/triangle/src/lib.rs b/triangle/src/lib.rs index 30556c0..ff93072 100644 --- a/triangle/src/lib.rs +++ b/triangle/src/lib.rs @@ -5,7 +5,7 @@ extern crate triangle_sys as sys; #[cfg(test)] mod tests; -use std::{ffi::CString, mem::MaybeUninit, ptr}; +use std::{ffi::CString, mem::MaybeUninit}; use anyhow::Result; @@ -49,17 +49,18 @@ pub fn triangulate

(opts: TrianglulateOpts

) -> Result where P: IntoIterator, { - let mut switches = Vec::new(); - switches.push("p".to_owned()); - switches.push("c".to_owned()); - switches.push("z".to_owned()); - switches.push("A".to_owned()); + let mut switches = vec![ + "p".to_owned(), + "c".to_owned(), + "z".to_owned(), + "A".to_owned(), + "q".to_owned(), + "e".to_owned(), + "n".to_owned(), + ]; if let Some(maximum_triangle_area) = opts.maximum_triangle_area { switches.push(format!("a{maximum_triangle_area}")); } - switches.push("q".to_owned()); - switches.push("e".to_owned()); - switches.push("n".to_owned()); if opts.voronoi { switches.push("v".to_owned()); }