Run clippy

This commit is contained in:
Maximilian Ammann 2022-03-10 17:04:56 +01:00
parent ddcae6737c
commit 9b99d5459e
13 changed files with 45 additions and 33 deletions

View File

@ -1,8 +1,8 @@
use criterion::{criterion_group, criterion_main, Criterion};
use lyon::tessellation::VertexBuffers;
use mapr::io::static_tile_fetcher::StaticTileFetcher;
use mapr::io::{HttpFetcherConfig, TileFetcher};
use mapr::tessellation::Tessellated;
use mapr::benchmarking::io::static_tile_fetcher::StaticTileFetcher;
use mapr::benchmarking::io::{HttpFetcherConfig, TileFetcher};
use mapr::benchmarking::tessellation::Tessellated;
use std::io::Cursor;
use vector_tile::parse_tile_reader;
use vector_tile::tile::Layer;

7
src/benchmarking.rs Normal file
View File

@ -0,0 +1,7 @@
pub mod io {
pub use crate::io::*;
}
pub mod tessellation {
pub use crate::tessellation::*;
}

View File

@ -1,11 +1,11 @@
//! File which exposes all kinds of coordinates used throughout mapr
use crate::io::tile_cache::TileCache;
use crate::util::math::{div_away, div_floor, Aabb2};
use crate::util::math::{div_floor, Aabb2};
use cgmath::num_traits::Pow;
use cgmath::{Matrix4, Point3, SquareMatrix, Vector3};
use cgmath::{Matrix4, Point3, Vector3};
use std::fmt;
use std::ops::Mul;
use style_spec::source::TileAdressingScheme;
pub const EXTENT_UINT: u32 = 4096;
@ -291,7 +291,7 @@ impl ViewRegion {
mod tests {
use crate::coords::{ViewRegion, WorldCoords, WorldTileCoords, EXTENT};
use crate::util::math::Aabb2;
use cgmath::{Point2, Vector3, Vector4, Zero};
use cgmath::{Point2, Vector4};
const TOP_LEFT: Vector4<f64> = Vector4::new(0.0, 0.0, 0.0, 1.0);
const BOTTOM_RIGHT: Vector4<f64> = Vector4::new(EXTENT, EXTENT, 0.0, 1.0);

View File

@ -29,7 +29,7 @@ impl ShiftHandler {
}
}
pub fn process_scroll(&mut self, delta: &winit::event::MouseScrollDelta) {
pub fn process_scroll(&mut self, _delta: &winit::event::MouseScrollDelta) {
/*self.camera_translate.z -= match delta {
winit::event::MouseScrollDelta::LineDelta(_horizontal, vertical) => *vertical as f64,
winit::event::MouseScrollDelta::PixelDelta(winit::dpi::PhysicalPosition {

View File

@ -1,9 +1,9 @@
use super::UpdateState;
use crate::coords::{WorldCoords, EXTENT};
use crate::render::camera::Camera;
use crate::render::render_state::RenderState;
use cgmath::num_traits::Pow;
use cgmath::{ulps_eq, EuclideanSpace, Matrix4, Point3, Vector2, Vector3, Vector4, Zero};
use cgmath::{Vector2, Vector3, Zero};
use std::time::Duration;
pub struct ZoomHandler {
@ -17,7 +17,7 @@ pub struct ZoomHandler {
}
impl UpdateState for ZoomHandler {
fn update_state(&mut self, state: &mut RenderState, dt: Duration) {
fn update_state(&mut self, state: &mut RenderState, _dt: Duration) {
if self.zoom_delta != 0.0 {
if let Some(window_position) = self.window_position {
let current_zoom = state.zoom;
@ -60,7 +60,7 @@ impl ZoomHandler {
}
}
pub fn process_window_position(&mut self, window_position: &Vector2<f64>, touch: bool) -> bool {
pub fn process_window_position(&mut self, window_position: &Vector2<f64>, _touch: bool) -> bool {
self.window_position = Some(*window_position);
true
}

View File

@ -1,4 +1,4 @@
use crate::coords::{TileCoords, WorldTileCoords};
use crate::coords::{WorldTileCoords};
use crate::io::workflow::LayerResult;
use std::collections::{btree_map, BTreeMap, HashSet};
use std::sync::{Arc, Mutex};

View File

@ -1,5 +1,5 @@
/// Describes through which channels work-requests travel. It describes the flow of work.
use crate::coords::{TileCoords, WorldTileCoords};
use crate::coords::WorldTileCoords;
use crate::io::tile_cache::TileCache;
use crate::io::web_tile_fetcher::WebTileFetcher;
use crate::io::{HttpFetcherConfig, TileFetcher};
@ -10,7 +10,7 @@ use log::{error, info, warn};
use std::collections::HashSet;
use std::fmt::{Debug, Formatter};
use std::sync::mpsc::{channel, Receiver, RecvError, SendError, Sender};
use std::sync::Mutex;
use style_spec::source::TileAdressingScheme;
use vector_tile::parse_tile_bytes;
use vector_tile::tile::Layer;
@ -138,9 +138,13 @@ impl TileRequestDispatcher {
let TileRequest { coords, layers } = &tile_request;
if let Some(missing_layers) =
tile_cache.get_missing_tessellated_layer_names_at(&coords, layers.clone())
tile_cache.get_missing_tessellated_layer_names_at(coords, layers.clone())
{
if self.pending_tiles.contains(&coords) {
if missing_layers.is_empty() {
return Ok(());
}
if self.pending_tiles.contains(coords) {
return Ok(());
}
self.pending_tiles.insert(*coords);
@ -148,7 +152,7 @@ impl TileRequestDispatcher {
info!("new tile request: {}", &coords);
self.request_sender.send(tile_request)
} else {
return Ok(());
Ok(())
}
}
}

View File

@ -5,10 +5,11 @@ pub(crate) mod error;
pub(crate) mod io;
pub(crate) mod main_loop;
pub(crate) mod render;
pub(crate) mod tessellation;
pub(crate) mod util;
// Used from outside to initialize mapr
pub mod platform;
// Used for benchmarking
pub mod tessellation;
pub mod benchmarking;

View File

@ -3,15 +3,15 @@
//! * Platform Events like suspend/resume
//! * Render a new frame
use crossbeam_channel::Receiver;
use log::{error, info, trace};
use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::Window;
use crate::input::{InputController, UpdateState};
use crate::io::tile_cache::TileCache;
use crate::io::workflow::{LayerResult, TileRequestDispatcher, Workflow};
use crate::io::workflow::{Workflow};
use crate::platform::Instant;
use crate::render::render_state::RenderState;

View File

@ -1,6 +1,6 @@
//! Module which is used if android, apple and web is not used.
use crate::io::tile_cache::TileCache;
use crate::io::workflow::Workflow;
use crate::main_loop;
use log::error;

View File

@ -7,8 +7,8 @@ use std::ops::Range;
use wgpu::BufferAddress;
use crate::coords::{TileCoords, WorldTileCoords};
use crate::render::shaders::ShaderTileMetadata;
use crate::coords::{WorldTileCoords};
use crate::tessellation::OverAlignedVertexBuffer;
pub trait Queue<B> {

View File

@ -3,9 +3,9 @@ use std::collections::HashSet;
use std::default::Default;
use std::{cmp, iter};
use crate::coords::{TileCoords, ViewRegion, WorldCoords, WorldTileCoords};
use crate::io::tile_cache::TileCache;
use crate::io::workflow::{LayerResult, TileRequest, TileRequestDispatcher, Workflow};
use crate::coords::{ViewRegion};
use crate::io::workflow::{LayerResult, TileRequest, Workflow};
use wgpu::{Buffer, Limits, Queue};
use winit::dpi::PhysicalSize;
use winit::window::Window;
@ -19,7 +19,7 @@ use crate::render::options::{
};
use crate::render::tile_mask_pattern::TileMaskPattern;
use crate::tessellation::IndexDataType;
use crate::util::math::Aabb2;
use crate::util::FPSMeter;
use super::piplines::*;

View File

@ -1,7 +1,7 @@
use std::ops::Add;
use bytemuck::Pod;
use lyon::geom::{point, vector};
use lyon::geom::{point};
use lyon::lyon_tessellation::VertexBuffers;
use lyon::tessellation::geometry_builder::MaxIndex;