Apply clippy lints (#278)

This commit is contained in:
TrueDoctor
2021-07-17 11:12:37 +02:00
committed by GitHub
parent d57bfb87ee
commit 4637cbf12b
10 changed files with 43 additions and 61 deletions

View File

@@ -67,7 +67,6 @@ impl Document {
/// Checks whether each layer under `path` intersects with the provided `quad` and adds all intersection layers as paths to `intersections`.
pub fn intersects_quad(&self, quad: [DVec2; 4], path: &mut Vec<LayerId>, intersections: &mut Vec<Vec<LayerId>>) {
self.document_folder(path).unwrap().intersects_quad(quad, path, intersections);
return;
}
/// Checks whether each layer under the root path intersects with the provided `quad` and returns the paths to all intersecting layers.
@@ -229,7 +228,7 @@ impl Document {
pub fn layer_axis_aligned_bounding_box(&self, path: &[LayerId]) -> Result<Option<[DVec2; 2]>, DocumentError> {
// TODO: Replace with functions of the transform api
if let &[] = path {
if path.is_empty() {
// Special case for root. Root's local is the documents global, so we avoid transforming its transform by itself.
self.layer_local_bounding_box(path)
} else {
@@ -265,13 +264,13 @@ impl Document {
Some(vec![DocumentResponse::DocumentChanged, DocumentResponse::SelectLayer { path }])
}
Operation::AddRect { path, insert_index, transform, style } => {
let id = self.add_layer(&path, Layer::new(LayerDataTypes::Rect(Rect::new()), *transform, *style), *insert_index)?;
let id = self.add_layer(&path, Layer::new(LayerDataTypes::Rect(Rect), *transform, *style), *insert_index)?;
let path = [path.clone(), vec![id]].concat();
Some(vec![DocumentResponse::DocumentChanged, DocumentResponse::SelectLayer { path }])
}
Operation::AddLine { path, insert_index, transform, style } => {
let id = self.add_layer(&path, Layer::new(LayerDataTypes::Line(Line::new()), *transform, *style), *insert_index)?;
let id = self.add_layer(&path, Layer::new(LayerDataTypes::Line(Line), *transform, *style), *insert_index)?;
let path = [path.clone(), vec![id]].concat();
Some(vec![DocumentResponse::DocumentChanged, DocumentResponse::SelectLayer { path }])