rust fmt+rust clippy

This commit is contained in:
shenjack 2023-04-09 00:10:16 +08:00
parent 7f41403b70
commit 0ffbd5a1e4
3 changed files with 7 additions and 16 deletions

View File

@ -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<bool> {

View File

@ -15,7 +15,8 @@ fn_single_line = true
# 自动对齐最大长度
enum_discrim_align_threshold = 5
# 字段初始化使用简写
use_field_init_shorthand = true
# 是否使用彩色输出
color = "Always"

View File

@ -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<Edge> = 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