Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Lint

on:
push:
branches: ["main"]
pull_request:
types: [opened, reopened, synchronize]
branches: ["main"]

permissions: {}

# Make sure CI fails on all warnings, including Clippy lints
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false

- name: Run Clippy
run: |
cargo clippy --all-targets --all-features
cargo clippy --all-targets --all-features --manifest-path python/Cargo.toml

format_check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false

- name: Run Rustfmt
run: |
cargo fmt --all --check -- --config imports_granularity=Module,group_imports=StdExternalCrate
cargo fmt --all --check --manifest-path python/Cargo.toml -- --config imports_granularity=Module,group_imports=StdExternalCrate
14 changes: 2 additions & 12 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
pull_request:

jobs:
lint-test:
name: Lint and Test
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -18,17 +18,9 @@ jobs:

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Cargo fmt
run: cargo fmt --all -- --check

- name: "clippy --all"
run: cargo clippy --all --all-features --tests -- -D warnings

- name: "cargo check"
run: cargo check --all --all-features

Expand All @@ -47,8 +39,6 @@ jobs:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,17 @@ on:
pull_request:

jobs:
lint-test:
name: Lint and Test
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v2

- name: Cargo fmt
run: cargo fmt --all -- --check

- name: "clippy --all"
run: cargo clippy --all --all-features --tests -- -D warnings

- run: cargo install cargo-all-features

- name: Check all combinations of features can build
Expand Down
1 change: 0 additions & 1 deletion python/src/thread_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::sync::Arc;

use pyo3::exceptions::PyValueError;
use pyo3::prelude::*;

use pyo3::sync::PyOnceLock;
use rayon::{ThreadPool, ThreadPoolBuilder};

Expand Down
8 changes: 4 additions & 4 deletions src/cog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ mod test {
use std::io::BufReader;
use std::sync::Arc;

use crate::metadata::{PrefetchBuffer, TiffMetadataReader};
use crate::reader::{AsyncFileReader, ObjectReader};

use super::*;
use object_store::local::LocalFileSystem;
use tiff::decoder::{DecodingResult, Limits};

use super::*;
use crate::metadata::{PrefetchBuffer, TiffMetadataReader};
use crate::reader::{AsyncFileReader, ObjectReader};

#[ignore = "local file"]
#[tokio::test]
async fn tmp() {
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Error handling.

use std::fmt::Debug;

use thiserror::Error;

/// Enum with all errors in this crate.
Expand Down
3 changes: 1 addition & 2 deletions src/geo/geo_key_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use std::collections::HashMap;

use num_enum::{IntoPrimitive, TryFromPrimitive};

use crate::tiff::Value;
use crate::tiff::{TiffError, TiffResult};
use crate::tiff::{TiffError, TiffResult, Value};

/// Geospatial TIFF tag variants
#[derive(Clone, Copy, Debug, PartialEq, TryFromPrimitive, IntoPrimitive, Eq, Hash)]
Expand Down
11 changes: 6 additions & 5 deletions src/metadata/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,14 +623,15 @@ async fn read_tag_value<F: MetadataFetch>(

#[cfg(test)]
mod test {
use crate::{
metadata::{reader::read_tag, MetadataFetch},
reader::Endianness,
tiff::{tags::Tag, Value},
};
use bytes::Bytes;
use futures::FutureExt;

use crate::metadata::reader::read_tag;
use crate::metadata::MetadataFetch;
use crate::reader::Endianness;
use crate::tiff::tags::Tag;
use crate::tiff::Value;

impl MetadataFetch for Bytes {
fn fetch(
&self,
Expand Down
11 changes: 4 additions & 7 deletions src/predictor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use std::fmt::Debug;

use bytes::{Bytes, BytesMut};

use crate::error::AsyncTiffError;
use crate::error::{AsyncTiffError, AsyncTiffResult};
use crate::reader::Endianness;
use crate::tiff::tags::PlanarConfiguration;
use crate::ImageFileDirectory;
use crate::{error::AsyncTiffResult, reader::Endianness};

/// All info that may be used by a predictor
///
Expand Down Expand Up @@ -397,12 +397,9 @@ mod test {

use bytes::Bytes;

use crate::{
predictor::{unpredict_float, unpredict_hdiff},
reader::Endianness,
};

use super::*;
use crate::predictor::{unpredict_float, unpredict_hdiff};
use crate::reader::Endianness;

const PRED_INFO: PredictorInfo = PredictorInfo {
endianness: Endianness::LittleEndian,
Expand Down
1 change: 1 addition & 0 deletions src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ impl<T: tokio::io::AsyncRead + tokio::io::AsyncSeek + Unpin + Send + Debug> Toki

async fn make_range_request(&self, range: Range<u64>) -> AsyncTiffResult<Bytes> {
use std::io::SeekFrom;

use tokio::io::{AsyncReadExt, AsyncSeekExt};

use crate::error::AsyncTiffError;
Expand Down
8 changes: 2 additions & 6 deletions src/tiff/error.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
use std::error::Error;
use std::fmt;
use std::fmt::Display;
use std::io;
use std::str;
use std::string;
use std::sync::Arc;
use std::{fmt, io, str, string};

use jpeg::UnsupportedFeature;

use super::ifd::Value;
use super::tags::Predictor;
use super::tags::{
CompressionMethod, PhotometricInterpretation, PlanarConfiguration, SampleFormat, Tag,
CompressionMethod, PhotometricInterpretation, PlanarConfiguration, Predictor, SampleFormat, Tag,
};

/// Tiff error kinds.
Expand Down