Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ unused_qualifications = "warn"

[workspace.lints.clippy]
# Restrictions
as_underscore = "warn"
panic = "warn"
panic_in_result_fn = "warn"
todo = "warn"
Expand Down
7 changes: 4 additions & 3 deletions martin-core/src/tiles/cog/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::io::{BufWriter, Read as _, Seek as _, SeekFrom};
use std::path::Path;

use martin_tile_utils::{Format, TileCoord, TileData};
use tiff::ColorType;
use tiff::decoder::Decoder;
use tiff::tags::CompressionMethod;
use tiff::{ColorType, decoder::Decoder};

use crate::tiles::cog::CogError;

Expand Down Expand Up @@ -32,7 +33,6 @@ pub struct Image {
}

impl Image {
#[allow(clippy::too_many_arguments)]
pub fn new(
ifd_index: usize,
zoom_level: u8,
Expand Down Expand Up @@ -281,9 +281,10 @@ fn encode_as_png(

#[cfg(test)]
mod tests {
use crate::tiles::cog::image::{Image, merge_jpeg_tables_with_tile};
use martin_tile_utils::TileCoord;

use crate::tiles::cog::image::{Image, merge_jpeg_tables_with_tile};

#[test]
fn can_calculate_correct_chunk_index() {
let image = Image {
Expand Down
12 changes: 7 additions & 5 deletions martin-core/src/tiles/cog/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct CogSource {

impl CogSource {
/// Creates a new COG tile source from a file path.
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
pub fn new(id: String, path: PathBuf) -> Result<Self, CogError> {
let tif_file =
File::open(&path).map_err(|e: std::io::Error| CogError::IoError(e, path.clone()))?;
Expand Down Expand Up @@ -381,13 +381,13 @@ fn get_tiles_origin(tile_size: u32, resolution: f64, origin: [f64; 2]) -> Option
let xf = ((origin[0] + (EARTH_CIRCUMFERENCE / 2.0)) / tile_size_mercator_metres).floor();
let yf = (((EARTH_CIRCUMFERENCE / 2.0) - origin[1]) / tile_size_mercator_metres).floor();
let tile_origin_x = if xf.is_finite() && xf >= 0.0 && xf <= f64::from(u32::MAX) {
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
#[expect(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
Some(xf as u32)
} else {
None
}?;
let tile_origin_y = if yf.is_finite() && yf >= 0.0 && yf <= f64::from(u32::MAX) {
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
#[expect(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
Some(yf as u32)
} else {
None
Expand Down Expand Up @@ -544,11 +544,13 @@ fn get_extent(

#[cfg(test)]
mod tests {
use crate::tiles::cog::CogSource;
use rstest::rstest;
use std::path::Path;

use rstest::rstest;
use tilejson::{Bounds, Center};

use crate::tiles::cog::CogSource;

#[rstest]
#[case("usda_naip_256_lzw_z3".to_string(), Center {
longitude: -121.346_740_722_656_22,
Expand Down
8 changes: 5 additions & 3 deletions martin/src/bin/martin-cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,11 @@ fn write_duration(f: &mut impl std::fmt::Write, secs: f32) -> std::fmt::Result {
} else if secs < 1. {
write!(f, "<1s")
} else {
// we've already handled cases of inf, or negative
#[allow(clippy::cast_possible_truncation)]
#[allow(clippy::cast_sign_loss)]
#[expect(
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
reason = "we've already handled cases of inf, or negative"
)]
let secs = secs.ceil() as u64;

let (mins, secs) = (secs / 60, secs % 60);
Expand Down
8 changes: 7 additions & 1 deletion martin/src/config/args/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ impl Args {

self.srv.merge_into_config(&mut config.srv);

#[allow(unused_mut)]
#[cfg_attr(
not(feature = "_tiles"),
expect(
clippy::unused_mut,
reason = "postgres may modify the cli strings to process input params"
)
)]
let mut cli_strings = Arguments::new(self.meta.connection);

#[cfg(feature = "postgres")]
Expand Down
2 changes: 1 addition & 1 deletion martin/src/config/file/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ impl Config {
#[cfg(feature = "_tiles")]
async fn resolve_tile_sources(
&mut self,
#[allow(unused_variables)] idr: &IdResolver,
idr: &IdResolver,
#[cfg(feature = "pmtiles")] pmtiles_cache: PmtCache,
) -> MartinResult<(TileSources, Vec<TileSourceWarning>)> {
let mut sources_and_warnings: Vec<BoxFuture<_>> = Vec::new();
Expand Down
12 changes: 7 additions & 5 deletions martin/src/config/file/resources/styles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,22 @@ pub struct InnerStyleConfig {

impl ConfigurationLivecycleHooks for InnerStyleConfig {
fn get_unrecognized_keys(&self) -> UnrecognizedKeys {
#[allow(unused_mut)]
#[cfg_attr(
not(all(feature = "unstable-rendering", target_os = "linux")),
expect(unused_mut, reason = "to warn for unrecognized keys")
)]
let mut keys = self
.unrecognized
.keys()
.cloned()
.collect::<UnrecognizedKeys>();
#[cfg(all(feature = "unstable-rendering", target_os = "linux"))]
match &self.rendering {
OptBoolObj::NoValue | OptBoolObj::Bool(_) => {}
OptBoolObj::Object(o) => keys.extend(
if let OptBoolObj::Object(o) = &self.rendering {
keys.extend(
o.get_unrecognized_keys()
.iter()
.map(|k| format!("rendering.{k}")),
),
);
}
keys
}
Expand Down
5 changes: 4 additions & 1 deletion mbtiles/src/bindiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ impl BinDiffer<DifferBefore, DifferAfter> for BinDiffDiffer {
}

async fn insert(&self, value: DifferAfter, conn: &mut SqliteConnection) -> MbtResult<()> {
#[expect(clippy::cast_possible_wrap)]
#[expect(
clippy::cast_possible_wrap,
reason = "the hash wrapping does not change the invariants and sqlite does not support u64"
)]
query(self.insert_sql.as_str())
.bind(value.coord.z)
.bind(value.coord.x)
Expand Down
Loading