Skip to content

Commit

Permalink
Run clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
maxammann committed May 7, 2022
1 parent 172dd75 commit 73b85fb
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 58 deletions.
5 changes: 2 additions & 3 deletions maplibre-winit/src/input/mod.rs
Expand Up @@ -3,7 +3,7 @@
use std::time::Duration;

use cgmath::Vector2;
use maplibre::coords::Zoom;

use winit::event::{DeviceEvent, KeyboardInput, TouchPhase, WindowEvent};

use crate::input::pan_handler::PanHandler;
Expand All @@ -12,8 +12,7 @@ use crate::input::query_handler::QueryHandler;
use crate::input::shift_handler::ShiftHandler;
use crate::input::tilt_handler::TiltHandler;
use crate::input::zoom_handler::ZoomHandler;
use maplibre::map_state::{MapState, ViewState};
use maplibre::render::camera::Camera;
use maplibre::map_state::ViewState;

mod pan_handler;
mod pinch_handler;
Expand Down
4 changes: 2 additions & 2 deletions maplibre-winit/src/input/pan_handler.rs
@@ -1,10 +1,10 @@
use super::UpdateState;

use maplibre::map_state::{MapState, ViewState};
use maplibre::map_state::ViewState;
use maplibre::render::camera::Camera;

use cgmath::{EuclideanSpace, Point3, Vector2, Vector3, Zero};
use maplibre::window::MapWindow;

use std::time::Duration;
use winit::event::{ElementState, MouseButton};

Expand Down
2 changes: 1 addition & 1 deletion maplibre-winit/src/input/query_handler.rs
@@ -1,7 +1,7 @@
use cgmath::Vector2;

use crate::input::UpdateState;
use maplibre::map_state::{MapState, ViewState};
use maplibre::map_state::ViewState;
use std::time::Duration;
use winit::event::{ElementState, MouseButton};

Expand Down
5 changes: 2 additions & 3 deletions maplibre-winit/src/input/tilt_handler.rs
@@ -1,10 +1,9 @@
use super::UpdateState;

use maplibre::map_state::{MapState, ViewState};
use maplibre::map_state::ViewState;

use cgmath::{Deg, Rad, Zero};
use maplibre::coords::Zoom;
use maplibre::render::camera::Camera;

use std::time::Duration;

pub struct TiltHandler {
Expand Down
6 changes: 3 additions & 3 deletions maplibre-winit/src/input/zoom_handler.rs
@@ -1,10 +1,10 @@
use super::UpdateState;

use maplibre::coords::Zoom;
use maplibre::map_state::{MapState, ViewState};
use maplibre::map_state::ViewState;

use cgmath::{Vector2, Vector3};
use maplibre::render::camera::Camera;

use std::time::Duration;

pub struct ZoomHandler {
Expand All @@ -14,7 +14,7 @@ pub struct ZoomHandler {
}

impl UpdateState for ZoomHandler {
fn update_state(&mut self, state: &mut ViewState, dt: Duration) {
fn update_state(&mut self, state: &mut ViewState, _dt: Duration) {
if let Some(zoom_delta) = self.zoom_delta {
if let Some(window_position) = self.window_position {
let current_zoom = state.zoom();
Expand Down
3 changes: 1 addition & 2 deletions maplibre-winit/src/winit/mod.rs
Expand Up @@ -4,11 +4,10 @@ use maplibre::io::scheduler::ScheduleMethod;
use maplibre::io::source_client::HTTPClient;
use winit::event::{ElementState, KeyboardInput, VirtualKeyCode, WindowEvent};
use winit::event_loop::ControlFlow;
use winit::window::WindowBuilder;

use crate::input::{InputController, UpdateState};
use maplibre::map_state::MapState;
use maplibre::window::{MapWindow, Runnable, WindowSize};
use maplibre::window::{MapWindow, Runnable};
use winit::event::Event;

#[cfg(target_arch = "wasm32")]
Expand Down
14 changes: 3 additions & 11 deletions maplibre-winit/src/winit/noweb.rs
Expand Up @@ -3,21 +3,13 @@
//! * Platform Events like suspend/resume
//! * Render a new frame

use instant::Instant;
use maplibre::error::Error;
use maplibre::io::scheduler::ScheduleMethod;
use maplibre::io::source_client::HTTPClient;
use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
use winit::event_loop::ControlFlow;
use winit::window::WindowBuilder;

use crate::input::{InputController, UpdateState};

use super::WinitEventLoop;
use super::WinitMapWindow;
use super::WinitWindow;
use maplibre::map_state::MapState;
use maplibre::window::{MapWindow, Runnable, WindowSize};

use maplibre::window::{MapWindow, WindowSize};

impl MapWindow for WinitMapWindow {
type EventLoop = WinitEventLoop;
Expand All @@ -33,7 +25,7 @@ impl MapWindow for WinitMapWindow {
.build(&event_loop)
.unwrap();

return (Self { inner: window }, event_loop);
(Self { inner: window }, event_loop)
}

fn size(&self) -> WindowSize {
Expand Down
19 changes: 5 additions & 14 deletions maplibre-winit/src/winit/web.rs
@@ -1,18 +1,10 @@
use instant::Instant;
use maplibre::error::Error;
use maplibre::io::scheduler::ScheduleMethod;
use maplibre::io::source_client::HTTPClient;
use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent};
use winit::event_loop::ControlFlow;
use winit::window::WindowBuilder;

use crate::input::{InputController, UpdateState};

use super::WinitEventLoop;
use super::WinitMapWindow;
use super::WinitWindow;
use maplibre::map_state::MapState;
use maplibre::window::{MapWindow, Runnable, WindowSize};

use maplibre::window::{MapWindow, WindowSize};
use winit::platform::web::WindowBuilderExtWebSys;

impl MapWindow for WinitMapWindow {
Expand All @@ -32,14 +24,13 @@ impl MapWindow for WinitMapWindow {

let size = get_body_size().unwrap();
window.set_inner_size(size);
return (Self { inner: window }, event_loop);
(Self { inner: window }, event_loop)
}

fn size(&self) -> WindowSize {
let size = self.inner.inner_size();
let window_size =
WindowSize::new(size.width, size.height).expect("failed to get window dimensions.");
window_size

WindowSize::new(size.width, size.height).expect("failed to get window dimensions.")
}

fn inner(&self) -> &Self::Window {
Expand Down
12 changes: 6 additions & 6 deletions maplibre/src/io/shared_thread_state.rs
@@ -1,16 +1,16 @@
use crate::coords::{TileCoords, WorldCoords, WorldTileCoords, Zoom};
use crate::coords::{WorldCoords, WorldTileCoords, Zoom};
use crate::error::Error;
use crate::io::geometry_index::{GeometryIndex, IndexProcessor, IndexedGeometry, TileIndex};
use crate::io::tile_request_state::TileRequestState;
use crate::io::{
LayerTessellateMessage, TessellateMessage, TileFetchResult, TileRequest, TileRequestID,
LayerTessellateMessage, TessellateMessage, TileRequest, TileRequestID,
TileTessellateMessage,
};
use crate::tessellation::Tessellated;

use std::collections::HashSet;

use crate::tessellation::zero_tessellator::ZeroTessellator;
use geozero::mvt::tile;

use geozero::GeozeroDatasource;
use prost::Message;
use std::sync::{mpsc, Arc, Mutex};
Expand Down Expand Up @@ -41,9 +41,9 @@ impl SharedThreadState {

let mut tile = geozero::mvt::Tile::decode(data.as_ref()).expect("failed to load tile");

let mut index = IndexProcessor::new();
let index = IndexProcessor::new();

for mut layer in &mut tile.layers {
for layer in &mut tile.layers {
let cloned_layer = layer.clone();
let layer_name: &str = &cloned_layer.name;
if !tile_request.layers.contains(layer_name) {
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/lib.rs
Expand Up @@ -48,7 +48,7 @@ where
self.run_with_optionally_max_frames(Some(max_frames));
}

pub fn run_with_optionally_max_frames(mut self, max_frames: Option<u64>) {
pub fn run_with_optionally_max_frames(self, max_frames: Option<u64>) {
self.window.run(self.map_state, self.event_loop, max_frames);
}
}
Expand Down
8 changes: 4 additions & 4 deletions maplibre/src/map_state.rs
Expand Up @@ -14,9 +14,9 @@ use crate::style::Style;
use crate::util::ChangeObserver;
use crate::{MapWindow, ScheduleMethod, WindowSize};
use std::collections::HashSet;
use std::sync;

use std::sync::{mpsc, Arc, Mutex};
use wgpu::SurfaceError;


pub struct ViewState {
zoom: ChangeObserver<Zoom>,
Expand Down Expand Up @@ -345,7 +345,7 @@ where
//let instance = wgpu::Instance::new(wgpu::Backends::GL);
//let instance = wgpu::Instance::new(wgpu::Backends::VULKAN);

let (window, event_loop) = W::create();
let (window, _event_loop) = W::create();
let window_size = window.size();

let surface = unsafe { instance.create_surface(window.inner()) };
Expand All @@ -357,7 +357,7 @@ where
// present_mode: wgpu::PresentMode::Mailbox,
present_mode: wgpu::PresentMode::Fifo, // VSync
};
let window_size = window.size();
let _window_size = window.size();
let render_state = RenderState::initialize(instance, surface, surface_config)
.await
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/render/render_state.rs
Expand Up @@ -22,7 +22,7 @@ use crate::render::options::{
use crate::render::tile_view_pattern::{TileInView, TileViewPattern};
use crate::tessellation::IndexDataType;
use crate::util::FPSMeter;
use crate::{MapWindow, WindowSize};
use crate::{MapWindow};

use super::piplines::*;
use super::shaders;
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/style/style.rs
Expand Up @@ -188,6 +188,6 @@ mod tests {
}
"##;

let style: Style = serde_json::from_str(&style_json_str).unwrap();
let _style: Style = serde_json::from_str(style_json_str).unwrap();
}
}
8 changes: 4 additions & 4 deletions maplibre/src/tessellation/zero_tessellator.rs
@@ -1,7 +1,7 @@
use bytemuck::Pod;

use geozero::{FeatureProcessor, GeomProcessor, PropertyProcessor};
use lyon::geom;
use lyon::geom::point;

use lyon::lyon_tessellation::VertexBuffers;
use lyon::path::path::Builder;
use lyon::path::Path;
Expand Down Expand Up @@ -85,7 +85,7 @@ impl<I: std::ops::Add + From<lyon::tessellation::VertexId> + MaxIndex> ZeroTesse
impl<I: std::ops::Add + From<lyon::tessellation::VertexId> + MaxIndex> GeomProcessor
for ZeroTessellator<I>
{
fn xy(&mut self, x: f64, y: f64, idx: usize) -> GeoResult<()> {
fn xy(&mut self, x: f64, y: f64, _idx: usize) -> GeoResult<()> {
// log::info!("xy");

if self.is_point {
Expand Down Expand Up @@ -167,7 +167,7 @@ impl<I: std::ops::Add + From<lyon::tessellation::VertexId> + MaxIndex> GeomProce
Ok(())
}

fn multipolygon_begin(&mut self, size: usize, idx: usize) -> GeoResult<()> {
fn multipolygon_begin(&mut self, _size: usize, _idx: usize) -> GeoResult<()> {
// log::info!("multipolygon_begin");
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion maplibre/src/tilejson/tilejson.rs
Expand Up @@ -132,7 +132,7 @@ mod tests {
}
"#;

let tilejson: TileJSON = serde_json::from_str(&tilejson_str).unwrap();
let tilejson: TileJSON = serde_json::from_str(tilejson_str).unwrap();

assert_eq!(
tilejson,
Expand Down
2 changes: 1 addition & 1 deletion web/src/error.rs
@@ -1,7 +1,7 @@
//! Errors which can happen in various parts of the library.

use js_sys::Error as JSError;
use wasm_bindgen::prelude::*;

use wasm_bindgen::{JsCast, JsValue};

#[derive(Debug)]
Expand Down

0 comments on commit 73b85fb

Please sign in to comment.