diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a55e8c7..6c73e19 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,3 +17,15 @@ jobs: uses: actions/checkout@v2 - name: Check formatting run: cargo fmt -v -- --check + clippy: + name: Check clippy + runs-on: ubuntu-latest + env: + RUSTFLAGS: "-Dwarnings" + steps: + - name: Get latest stable Rust + run: rustup toolchain install stable --profile default + - name: Check out source + uses: actions/checkout@v2 + - name: Run clippy + run: cargo clippy diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a36e20d..279bf25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,13 +38,3 @@ jobs: uses: actions/checkout@v2 - name: Run tests run: cargo test --all - msrv: - name: Run tests on mininum supported rust version - runs-on: ubuntu-latest - steps: - - name: Get minimum supported Rust - run: rustup toolchain install 1.51.0 --profile minimal - - name: Check out source - uses: actions/checkout@v2 - - name: Run tests - run: cargo test --all diff --git a/Cargo.toml b/Cargo.toml index 0bc6464..1a41ce6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "mailparse" version = "0.17.0" authors = ["Kartikaya Gupta"] edition = "2024" +rust-version = "1.85.0" license = "0BSD" description = "A simple parser for MIME e-mail messages" diff --git a/README.md b/README.md index 1e894f0..860990b 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ See the rustdoc at [docs.rs](https://docs.rs/mailparse/). MSRV policy --- -Currently the minimum supported Rust version (MSRV) is 1.51.0. +Currently the minimum supported Rust version (MSRV) is 1.85.0. MSRV increases will be kept to a minimum, and will always be accompanied with a minor version bump. Contributing diff --git a/src/addrparse.rs b/src/addrparse.rs index fa55fac..7a44ac2 100644 --- a/src/addrparse.rs +++ b/src/addrparse.rs @@ -593,7 +593,7 @@ fn addrparse_inner( // Technically not valid, but occurs in real-world corpus, so handle it gracefully state = AddrParseState::Initial; addr = None; - } else if c == ':' && !addr.as_ref().map_or(false, |s| s.contains('@')) { + } else if c == ':' && !addr.as_ref().is_some_and(|s| s.contains('@')) { if in_group { return Err(MailParseError::Generic( "Found unexpected nested group", diff --git a/src/bytescan.rs b/src/bytescan.rs index 4efa65c..078bae2 100644 --- a/src/bytescan.rs +++ b/src/bytescan.rs @@ -3,9 +3,6 @@ //! Uses the classic haszero/hasless bit tricks (Bit Twiddling Hacks) on usize //! words loaded with from_le_bytes. No unsafe, no dependencies. -// clippy suggests as_chunks here, but that needs Rust 1.88. -#![allow(clippy::chunks_exact_to_as_chunks)] - const WORD: usize = core::mem::size_of::(); const LO: usize = usize::from_ne_bytes([0x01; WORD]); const HI: usize = usize::from_ne_bytes([0x80; WORD]); diff --git a/src/lib.rs b/src/lib.rs index 2504791..f0f7752 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1072,7 +1072,7 @@ fn unescape(text: &str) -> String { } unescaped.push(c); } - return unescaped; + unescaped } /// Parse parameterized header values such as that for Content-Type @@ -1153,7 +1153,7 @@ fn parse_param_content(content: &str) -> ParamContent { let mut pending_charset: Option = None; let mut index = 0; loop { - let segment_key = format!("{}*{}", &base, index); + let segment_key = format!("{}*{}", base, index); if let Some((octets, charset)) = octet_segments.remove(&segment_key) { // Encoded segment: accumulate octets (all share the *0 charset). pending_charset = Some(charset);