From 0ffbd5a1e46f806da781c8969b668575f536180b Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 9 Apr 2023 00:10:16 +0800 Subject: [PATCH] rust fmt+rust clippy --- libs/Difficult_Rocket_rs/src/src/lib.rs | 2 +- libs/Difficult_Rocket_rs/src/src/rustfmt.toml | 3 ++- libs/Difficult_Rocket_rs/src/src/types.rs | 18 ++++-------------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/libs/Difficult_Rocket_rs/src/src/lib.rs b/libs/Difficult_Rocket_rs/src/src/lib.rs index b3e7c7c..cf5ee5d 100644 --- a/libs/Difficult_Rocket_rs/src/src/lib.rs +++ b/libs/Difficult_Rocket_rs/src/src/lib.rs @@ -16,7 +16,7 @@ mod types; use pyo3::prelude::*; #[pyfunction] -fn get_version_str() -> String { return "0.2.6.1".to_string(); } +fn get_version_str() -> String { "0.2.6.1".to_string() } #[pyfunction] fn test_call(py_obj: &PyAny) -> PyResult { diff --git a/libs/Difficult_Rocket_rs/src/src/rustfmt.toml b/libs/Difficult_Rocket_rs/src/src/rustfmt.toml index ac4a7ee..83ba4b7 100644 --- a/libs/Difficult_Rocket_rs/src/src/rustfmt.toml +++ b/libs/Difficult_Rocket_rs/src/src/rustfmt.toml @@ -15,7 +15,8 @@ fn_single_line = true # 自动对齐最大长度 enum_discrim_align_threshold = 5 - +# 字段初始化使用简写 +use_field_init_shorthand = true # 是否使用彩色输出 color = "Always" diff --git a/libs/Difficult_Rocket_rs/src/src/types.rs b/libs/Difficult_Rocket_rs/src/src/types.rs index a6c1d5e..1df198e 100644 --- a/libs/Difficult_Rocket_rs/src/src/types.rs +++ b/libs/Difficult_Rocket_rs/src/src/types.rs @@ -602,9 +602,7 @@ pub mod math { pub trait Rotatable { // 懒了,直接实现一个协议得了 - #[inline] fn rotate(&self, angle: f64) -> Self; - #[inline] fn rotate_radius(&self, radius: f64) -> Self; } @@ -705,18 +703,10 @@ pub mod math { let d_width = width / 2.0; let d_height = height / 2.0; let mut edges: Vec = vec![ - Edge::OneTimeLine { - 0: OneTimeLine::pos_new(-d_width, -d_height, d_width, -d_height), - }, - Edge::OneTimeLine { - 0: OneTimeLine::pos_new(d_width, -d_height, d_width, d_height), - }, - Edge::OneTimeLine { - 0: OneTimeLine::pos_new(d_width, d_height, -d_width, d_height), - }, - Edge::OneTimeLine { - 0: OneTimeLine::pos_new(-d_width, d_height, -d_width, -d_height), - }, + Edge::OneTimeLine(OneTimeLine::pos_new(-d_width, -d_height, d_width, -d_height)), + Edge::OneTimeLine(OneTimeLine::pos_new(d_width, -d_height, d_width, d_height)), + Edge::OneTimeLine(OneTimeLine::pos_new(d_width, d_height, -d_width, d_height)), + Edge::OneTimeLine(OneTimeLine::pos_new(-d_width, d_height, -d_width, -d_height)), ]; if let Some(angle) = angle { edges = edges