From 6b1fe613c2e6e2c7942608521ddc3baf3d5e47d3 Mon Sep 17 00:00:00 2001 From: Jeremy Schlatter Date: Thu, 4 Jul 2024 07:55:02 -0700 Subject: [PATCH] flake: remove redundant transitive dependencies (#1986) * flake: remove redundant transitive dependencies - add several more `follows` relationships for de-duplication - update to latest rust-overlay flake which drops flake-utils dependency - set `follows = ""` for a few unused dependencies. See https://github.com/NixOS/nix/issues/7807 * delete `follows = ""` hacks * delete one more `follows = ""` hack * Fix new clippy 1.79 errors --------- Co-authored-by: Yann Hamdaoui --- core/src/error/suggest.rs | 2 +- core/src/identifier.rs | 4 +- core/src/nix_ffi/mod.rs | 1 - core/src/parser/utils.rs | 2 +- flake.lock | 253 +++++--------------------------------- flake.nix | 17 ++- 6 files changed, 50 insertions(+), 229 deletions(-) diff --git a/core/src/error/suggest.rs b/core/src/error/suggest.rs index 900f095865..5a9b906128 100644 --- a/core/src/error/suggest.rs +++ b/core/src/error/suggest.rs @@ -24,7 +24,7 @@ where S: AsRef, I: AsRef, { - let mut max = std::f64::MIN; + let mut max = f64::MIN; let mut arg_max: Option<&'syms str> = None; if symbols.is_empty() { diff --git a/core/src/identifier.rs b/core/src/identifier.rs index d3d4caae3b..d24a5e382a 100644 --- a/core/src/identifier.rs +++ b/core/src/identifier.rs @@ -301,7 +301,9 @@ mod interner { // deallocation, so references are valid until the arena drop, which is tied to the // struct drop. let in_string = unsafe { - std::mem::transmute(self.arena.lock().unwrap().alloc_str(string.as_ref())) + std::mem::transmute::<&'_ str, &'a str>( + self.arena.lock().unwrap().alloc_str(string.as_ref()), + ) }; let sym = Symbol(self.vec.len() as u32); self.vec.push(in_string); diff --git a/core/src/nix_ffi/mod.rs b/core/src/nix_ffi/mod.rs index 8851fcaa1f..35a63df7d6 100644 --- a/core/src/nix_ffi/mod.rs +++ b/core/src/nix_ffi/mod.rs @@ -1,4 +1,3 @@ -#![cfg(feature = "nix-experimental")] #[cxx::bridge] mod internal { unsafe extern "C++" { diff --git a/core/src/parser/utils.rs b/core/src/parser/utils.rs index 976dff6442..57d71e2ea3 100644 --- a/core/src/parser/utils.rs +++ b/core/src/parser/utils.rs @@ -654,7 +654,7 @@ pub fn mk_fun(pat: Pattern, body: RichTerm) -> Term { /// either a space or a tab, counted from the beginning of the line. If a line is empty or consist /// only of whitespace characters, it is ignored. pub fn min_indent(chunks: &[StrChunk]) -> usize { - let mut min: usize = std::usize::MAX; + let mut min: usize = usize::MAX; let mut current = 0; let mut start_line = true; diff --git a/flake.lock b/flake.lock index 7b337170ca..ee5c4502b8 100644 --- a/flake.lock +++ b/flake.lock @@ -36,44 +36,7 @@ "type": "github" } }, - "crane_2": { - "inputs": { - "nixpkgs": [ - "topiary", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715274763, - "narHash": "sha256-3Iv1PGHJn9sV3HO4FlOVaaztOxa9uGLfOmUWrH7v7+A=", - "owner": "ipetkov", - "repo": "crane", - "rev": "27025ab71bdca30e7ed0a16c88fd74c5970fc7f5", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { "flake": false, "locked": { "lastModified": 1696426674, @@ -128,57 +91,6 @@ "type": "github" } }, - "flake-utils_2": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -233,13 +145,20 @@ }, "nix-input": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": [ + "pre-commit-hooks", + "flake-compat" + ], "flake-parts": "flake-parts", "libgit2": "libgit2", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "nixpkgs-23-11": "nixpkgs-23-11", "nixpkgs-regression": "nixpkgs-regression", - "pre-commit-hooks": "pre-commit-hooks" + "pre-commit-hooks": [ + "pre-commit-hooks" + ] }, "locked": { "lastModified": 1717862855, @@ -257,18 +176,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1717432640, - "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", + "lastModified": 1717786204, + "narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88269ab3044128b7c2f4c7d68448b2fb50456870", + "rev": "051f920625ab5aabe37c920346e3e69d7d34400e", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "release-24.05", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" } }, "nixpkgs-23-11": { @@ -319,72 +237,9 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1717786204, - "narHash": "sha256-4q0s6m0GUcN7q+Y2DqD27iLvbcd1G50T2lv08kKxkSI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "051f920625ab5aabe37c920346e3e69d7d34400e", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { - "flake-compat": [ - "nix-input" - ], - "flake-utils": "flake-utils_2", - "gitignore": [ - "nix-input" - ], - "nixpkgs": [ - "nix-input", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nix-input", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1712897695, - "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "pre-commit-hooks_2": { - "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" @@ -410,46 +265,24 @@ "crane": "crane", "flake-utils": "flake-utils", "nix-input": "nix-input", - "nixpkgs": "nixpkgs_2", - "pre-commit-hooks": "pre-commit-hooks_2", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", "rust-overlay": "rust-overlay", "topiary": "topiary" } }, "rust-overlay": { "inputs": { - "flake-utils": [ - "flake-utils" - ], "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1717813066, - "narHash": "sha256-wqbRwq3i7g5EHIui0bIi84mdqZ/It1AXBSLJ5tafD28=", + "lastModified": 1719973106, + "narHash": "sha256-IGCdN/m7DfwUfxZjFnlTiTtpwSHCb01P/LWavAKD2jw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "6dc3e45fe4aee36efeed24d64fc68b1f989d5465", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1715739484, - "narHash": "sha256-5zlSuCM54jH6tXi8OILZ7opT+lBYUkGU9eOMEvJh9HU=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "3d27c65641a61d36f1c7616d6150524cd9a2a5f7", + "rev": "fb733500aead50880b9b301f34a0061bf997d6f2", "type": "github" }, "original": { @@ -473,46 +306,22 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "topiary": { "inputs": { "advisory-db": "advisory-db", - "crane": "crane_2", - "flake-utils": "flake-utils_3", + "crane": [ + "crane" + ], + "flake-utils": [ + "flake-utils" + ], "nix-filter": "nix-filter", "nixpkgs": [ "nixpkgs" ], - "rust-overlay": "rust-overlay_2" + "rust-overlay": [ + "rust-overlay" + ] }, "locked": { "lastModified": 1718001536, diff --git a/flake.nix b/flake.nix index b6f1e94005..6974d1ea8e 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,6 @@ rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.flake-utils.follows = "flake-utils"; }; crane = { url = "github:ipetkov/crane"; @@ -17,9 +16,21 @@ }; topiary = { url = "github:tweag/topiary"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + nixpkgs.follows = "nixpkgs"; + crane.follows = "crane"; + flake-utils.follows = "flake-utils"; + rust-overlay.follows = "rust-overlay"; + }; + }; + nix-input = { + url = "github:nixos/nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-compat.follows = "pre-commit-hooks/flake-compat"; + pre-commit-hooks.follows = "pre-commit-hooks"; + }; }; - nix-input.url = "github:nixos/nix"; }; nixConfig = {