mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Clippy fixes (#206)
* Clippy fixes * Clippy: add Default implementations * Clippy: Simplify if let match * Clippy: Fix never read variables Co-authored-by: Max Ammann <max@maxammann.org>
This commit is contained in:
parent
fec6a408ee
commit
c77ce85741
@ -80,7 +80,7 @@ pub fn validate_project_wgsl() {
|
||||
{
|
||||
format!(":{}:{} {}", line_number, line_position, error)
|
||||
} else {
|
||||
format!("{}", error)
|
||||
error
|
||||
},
|
||||
WgslError::IoErr(error) => format!(": {:?}", error),
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ impl HeadlessMap {
|
||||
&mut pipeline_context,
|
||||
);
|
||||
|
||||
let mut processor = pipeline_context
|
||||
let processor = pipeline_context
|
||||
.take_processor::<HeadlessPipelineProcessor>()
|
||||
.expect("Unable to get processor");
|
||||
|
||||
|
||||
@ -62,6 +62,12 @@ impl GeometryIndex {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GeometryIndex {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
/// Index of tiles which can be of two types: spatial or linear.
|
||||
/// Spatial tiles are stored in a multi-dimentional tree which represents their position in the tile.
|
||||
/// Linear tiles are simply stored in a vector.
|
||||
@ -198,6 +204,12 @@ impl IndexProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for IndexProcessor {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl GeomProcessor for IndexProcessor {
|
||||
fn xy(&mut self, x: f64, y: f64, idx: usize) -> Result<(), GeozeroError> {
|
||||
self.geo_writer.xy(x, y, idx)
|
||||
|
||||
@ -140,13 +140,10 @@ impl TileRepository {
|
||||
|
||||
/// Create a new tile.
|
||||
pub fn create_tile(&mut self, coords: WorldTileCoords) -> bool {
|
||||
if let Some(entry) = coords.build_quad_key().map(|key| self.tree.entry(key)) {
|
||||
match entry {
|
||||
btree_map::Entry::Vacant(entry) => {
|
||||
entry.insert(StoredTile::pending(coords));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(btree_map::Entry::Vacant(entry)) =
|
||||
coords.build_quad_key().map(|key| self.tree.entry(key))
|
||||
{
|
||||
entry.insert(StoredTile::pending(coords));
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
@ -44,6 +44,12 @@ pub struct KernelBuilder<E: Environment> {
|
||||
http_client: Option<E::HttpClient>,
|
||||
}
|
||||
|
||||
impl<E: Environment> Default for KernelBuilder<E> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Environment> KernelBuilder<E> {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
||||
@ -30,3 +30,9 @@ impl Scheduler for TokioScheduler {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TokioScheduler {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,12 @@ impl RendererBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for RendererBuilder {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
pub enum InitializationResult {
|
||||
Initialized(InitializedRenderer),
|
||||
Uninizalized(UninitializedRenderer),
|
||||
@ -110,7 +116,7 @@ impl UninitializedRenderer {
|
||||
Ok(Renderer::initialize_headless(
|
||||
existing_window,
|
||||
self.wgpu_settings.clone(),
|
||||
self.renderer_settings.clone(),
|
||||
self.renderer_settings,
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
||||
@ -264,11 +264,8 @@ impl Renderer {
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let trace_path = None;
|
||||
|
||||
// Maybe get features and limits based on what is supported by the adapter/backend
|
||||
let mut features = wgpu::Features::empty();
|
||||
let mut limits = settings.limits.clone();
|
||||
|
||||
features = adapter.features() | wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
||||
let mut features =
|
||||
adapter.features() | wgpu::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES;
|
||||
if adapter_info.device_type == wgpu::DeviceType::DiscreteGpu {
|
||||
// `MAPPABLE_PRIMARY_BUFFERS` can have a significant, negative performance impact for
|
||||
// discrete GPUs due to having to transfer data across the PCI-E bus and so it
|
||||
@ -276,7 +273,7 @@ impl Renderer {
|
||||
// integrated GPUs.
|
||||
features -= wgpu::Features::MAPPABLE_PRIMARY_BUFFERS;
|
||||
}
|
||||
limits = adapter.limits();
|
||||
let mut limits = adapter.limits();
|
||||
|
||||
// Enforce the disabled features
|
||||
if let Some(disabled_features) = settings.disabled_features {
|
||||
|
||||
@ -582,6 +582,12 @@ impl RingIndex {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for RingIndex {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use lyon::tessellation::VertexBuffers;
|
||||
|
||||
@ -37,3 +37,9 @@ impl FPSMeter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FPSMeter {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user