From 9d331483e949ccd7523e9e304173f529333391a3 Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 17 Dec 2024 16:57:29 +0100 Subject: [PATCH 1/3] Revert "build: increase MSRV to 1.81.0" This reverts commit ffe6efe819abdd894dd317d46b62cc46a0814301. --- .github/workflows/ci.yml | 4 ++-- Cargo.toml | 2 +- src/chat.rs | 4 ++-- src/contact.rs | 1 + src/imap.rs | 3 ++- src/mimefactory.rs | 1 + src/mimeparser.rs | 2 +- src/param.rs | 1 + src/pgp.rs | 2 ++ src/quota.rs | 2 +- src/receive_imf.rs | 9 +++++---- src/smtp.rs | 2 +- src/smtp/connect.rs | 2 +- 13 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbd77e872..ab63e5b16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,9 +103,9 @@ jobs: - os: macos-latest rust: 1.83.0 - # Minimum Supported Rust Version = 1.81.0 + # Minimum Supported Rust Version = 1.77.0 - os: ubuntu-latest - rust: 1.81.0 + rust: 1.77.0 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 1a5f56196..dbf0eb202 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "deltachat" version = "1.152.0" edition = "2021" license = "MPL-2.0" -rust-version = "1.81" +rust-version = "1.77" repository = "https://github.com/deltachat/deltachat-core-rust" [profile.dev] diff --git a/src/chat.rs b/src/chat.rs index 320fffb85..437dbff4e 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -312,7 +312,7 @@ impl ChatId { /// Create a group or mailinglist raw database record with the given parameters. /// The function does not add SELF nor checks if the record already exists. - #[expect(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub(crate) async fn create_multiuser_record( context: &Context, chattype: Chattype, @@ -4444,7 +4444,7 @@ pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Resul /// /// For example, it can be a message showing that a member was added to a group. /// Doesn't fail if the chat doesn't exist. -#[expect(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments)] pub(crate) async fn add_info_msg_with_cmd( context: &Context, chat_id: ChatId, diff --git a/src/contact.rs b/src/contact.rs index 61ad7db1f..6ce4ecfa9 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -805,6 +805,7 @@ impl Contact { } let mut name = sanitize_name(name); + #[allow(clippy::collapsible_if)] if origin <= Origin::OutgoingTo { // The user may accidentally have written to a "noreply" address with another MUA: if addr.contains("noreply") diff --git a/src/imap.rs b/src/imap.rs index cbf241071..50a159b38 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -1301,7 +1301,7 @@ impl Session { /// Returns the last UID fetched successfully and the info about each downloaded message. /// If the message is incorrect or there is a failure to write a message to the database, /// it is skipped and the error is logged. - #[expect(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub(crate) async fn fetch_many_msgs( &mut self, context: &Context, @@ -2689,6 +2689,7 @@ mod tests { } } + #[allow(clippy::too_many_arguments)] async fn check_target_folder_combination( folder: &str, mvbox_move: bool, diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 878007304..8f5f66f01 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1047,6 +1047,7 @@ impl MimeFactory { part.body(text) } + #[allow(clippy::cognitive_complexity)] async fn render_message( &mut self, context: &Context, diff --git a/src/mimeparser.rs b/src/mimeparser.rs index 4eb80b4d9..b8c2358ba 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -1279,7 +1279,7 @@ impl MimeMessage { Ok(self.parts.len() > old_part_count) } - #[expect(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] async fn do_add_single_file_part( &mut self, context: &Context, diff --git a/src/param.rs b/src/param.rs index f1d3cb761..d83beef6b 100644 --- a/src/param.rs +++ b/src/param.rs @@ -371,6 +371,7 @@ impl Params { /// Note that in the [ParamsFile::FsPath] case the blob can be /// created without copying if the path already refers to a valid /// blob. If so a [BlobObject] will be returned. + #[allow(clippy::needless_lifetimes)] pub async fn get_blob<'a>( &self, key: Param, diff --git a/src/pgp.rs b/src/pgp.rs index 804d520c0..f729237d9 100644 --- a/src/pgp.rs +++ b/src/pgp.rs @@ -21,9 +21,11 @@ use tokio::runtime::Handle; use crate::constants::KeyGenType; use crate::key::{DcKey, Fingerprint}; +#[allow(missing_docs)] #[cfg(test)] pub(crate) const HEADER_AUTOCRYPT: &str = "autocrypt-prefer-encrypt"; +#[allow(missing_docs)] pub const HEADER_SETUPCODE: &str = "passphrase-begin"; /// Preferred symmetric encryption algorithm. diff --git a/src/quota.rs b/src/quota.rs index a0e8df346..0070a76ca 100644 --- a/src/quota.rs +++ b/src/quota.rs @@ -187,7 +187,7 @@ mod tests { Ok(()) } - #[expect(clippy::assertions_on_constants)] + #[allow(clippy::assertions_on_constants)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_quota_thresholds() -> anyhow::Result<()> { assert!(QUOTA_ALLCLEAR_PERCENTAGE > 50); diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 439731e9b..3a58c5473 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -158,7 +158,7 @@ async fn insert_tombstone(context: &Context, rfc724_mid: &str) -> Result /// If `is_partial_download` is set, it contains the full message size in bytes. /// Do not confuse that with `replace_msg_id` that will be set when the full message is loaded /// later. -#[expect(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments)] pub(crate) async fn receive_imf_inner( context: &Context, folder: &str, @@ -679,7 +679,7 @@ pub async fn from_field_to_contact_id( /// Creates a `ReceivedMsg` from given parts which might consist of /// multiple messages (if there are multiple attachments). /// Every entry in `mime_parser.parts` produces a new row in the `msgs` table. -#[expect(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments, clippy::cognitive_complexity)] async fn add_parts( context: &Context, mime_parser: &mut MimeMessage, @@ -1834,7 +1834,7 @@ async fn lookup_chat_by_reply( Ok(Some((parent_chat.id, parent_chat.blocked))) } -#[expect(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments)] async fn lookup_chat_or_create_adhoc_group( context: &Context, mime_parser: &MimeMessage, @@ -1969,7 +1969,7 @@ async fn is_probably_private_reply( /// than two members, a new ad hoc group is created. /// /// On success the function returns the created (chat_id, chat_blocked) tuple. -#[expect(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments)] async fn create_group( context: &Context, mime_parser: &mut MimeMessage, @@ -2089,6 +2089,7 @@ async fn create_group( /// just omitted. /// /// * `is_partial_download` - whether the message is not fully downloaded. +#[allow(clippy::too_many_arguments)] async fn apply_group_changes( context: &Context, mime_parser: &mut MimeMessage, diff --git a/src/smtp.rs b/src/smtp.rs index 84b093642..7bc51a278 100644 --- a/src/smtp.rs +++ b/src/smtp.rs @@ -104,7 +104,7 @@ impl Smtp { } /// Connect using the provided login params. - #[expect(clippy::too_many_arguments)] + #[allow(clippy::too_many_arguments)] pub async fn connect( &mut self, context: &Context, diff --git a/src/smtp/connect.rs b/src/smtp/connect.rs index 869405cd3..5652d1427 100644 --- a/src/smtp/connect.rs +++ b/src/smtp/connect.rs @@ -45,7 +45,7 @@ async fn new_smtp_transport( Ok(transport) } -#[expect(clippy::too_many_arguments)] +#[allow(clippy::too_many_arguments)] pub(crate) async fn connect_and_auth( context: &Context, proxy_config: &Option, From d822da3c9f09b1a7aeb5528cb69859afddc5f46e Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 17 Dec 2024 17:13:47 +0100 Subject: [PATCH 2/3] build: downgrade Rust version used to build binaries This fixes the problem of VirusTotal reporting the binaries built with `nix build .#deltachat-rpc-server-win64` as malware. --- flake.lock | 7 ++++--- flake.nix | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index bf2051201..61d10e0bb 100644 --- a/flake.lock +++ b/flake.lock @@ -47,16 +47,17 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1731393059, - "narHash": "sha256-rmzi0GHEwpzg1LGfGPO4SRD7D6QGV3UYGQxkJvn+J5U=", + "lastModified": 1711088506, + "narHash": "sha256-USdlY7Tx2oJWqFBpp10+03+h7eVhpkQ4s9t1ERjeIJE=", "owner": "nix-community", "repo": "fenix", - "rev": "fda8d5b59bb0dc0021ad3ba1d722f9ef6d36e4d9", + "rev": "85f4139f3c092cf4afd9f9906d7ed218ef262c97", "type": "github" }, "original": { "owner": "nix-community", "repo": "fenix", + "rev": "85f4139f3c092cf4afd9f9906d7ed218ef262c97", "type": "github" } }, diff --git a/flake.nix b/flake.nix index f4b8ee4db..a92eda700 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "Delta Chat core"; inputs = { - fenix.url = "github:nix-community/fenix"; + fenix.url = "github:nix-community/fenix?rev=85f4139f3c092cf4afd9f9906d7ed218ef262c97"; flake-utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; nix-filter.url = "github:numtide/nix-filter"; From 5069b585c832c3d613963f9d44b0ce7900398d2b Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 17 Dec 2024 17:53:51 +0000 Subject: [PATCH 3/3] bulid(nix): use new fenix for dev shell --- flake.lock | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 11 ++++++++--- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 61d10e0bb..52c59ca6c 100644 --- a/flake.lock +++ b/flake.lock @@ -115,6 +115,25 @@ "type": "github" } }, + "new-fenix": { + "inputs": { + "nixpkgs": "nixpkgs_4", + "rust-analyzer-src": "rust-analyzer-src_2" + }, + "locked": { + "lastModified": 1734417396, + "narHash": "sha256-32x1Z+Pz3Jv0cK9EG56cFTKXy/mZ/c+Ikxw+aVfKHp4=", + "owner": "nix-community", + "repo": "fenix", + "rev": "a18d41b26e998e95a598858fdb86ba22fb5da47d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "nix-filter": { "locked": { "lastModified": 1730207686, @@ -175,6 +194,22 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 1734119587, + "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1731139594, "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", @@ -196,8 +231,9 @@ "fenix": "fenix", "flake-utils": "flake-utils_2", "naersk": "naersk", + "new-fenix": "new-fenix", "nix-filter": "nix-filter", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" } }, "rust-analyzer-src": { @@ -217,6 +253,23 @@ "type": "github" } }, + "rust-analyzer-src_2": { + "flake": false, + "locked": { + "lastModified": 1734386068, + "narHash": "sha256-Py025JiD9lcPmldB7X1AEjq3WBTS60jZUJRtTDonmaE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "0a706f7d2ac093985eae317781200689cfd48b78", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index a92eda700..d804b1e56 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,19 @@ { description = "Delta Chat core"; inputs = { + # Old Rust to build releases. fenix.url = "github:nix-community/fenix?rev=85f4139f3c092cf4afd9f9906d7ed218ef262c97"; + + # New Rust for development shell. + new-fenix.url = "github:nix-community/fenix"; + flake-utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; nix-filter.url = "github:numtide/nix-filter"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; android.url = "github:tadfisher/android-nixpkgs"; }; - outputs = { self, nixpkgs, flake-utils, nix-filter, naersk, fenix, android }: + outputs = { self, nixpkgs, flake-utils, nix-filter, naersk, fenix, new-fenix, android }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; @@ -539,13 +544,13 @@ let pkgs = import nixpkgs { system = system; - overlays = [ fenix.overlays.default ]; + overlays = [ new-fenix.overlays.default ]; }; in pkgs.mkShell { buildInputs = with pkgs; [ - (fenix.packages.${system}.complete.withComponents [ + (new-fenix.packages.${system}.complete.withComponents [ "cargo" "clippy" "rust-src"