Use Nightly + Cranelift for dev, only fail on warnings in CI (#4388)

* Switch to nightly + cranelift

* Fail on warnings only in CI

* Fix check errors

* Don't use mold on Linux to fix CI

* Pin nightly toolchain and add default rustup components

* Fix another CI thing

* PR comment
This commit is contained in:
aecsocket
2025-09-18 19:20:19 +01:00
committed by GitHub
parent 4def0e8407
commit 36d0760a3e
7 changed files with 30 additions and 24 deletions

View File

@@ -1,9 +1,16 @@
# Windows has stack overflows when calling from Tauri, so we increase the default stack size used by the compiler
[target.'cfg(windows)']
rustflags = ["-C", "link-args=/STACK:16777220", "--cfg", "tokio_unstable"]
# Enable Cranelift for debug builds, improving iterative compile times
[unstable]
codegen-backend = true
[target.x86_64-pc-windows-msvc]
linker = "rust-lld"
[profile.dev]
codegen-backend = "cranelift"
[build]
rustflags = ["--cfg", "tokio_unstable"]
# Windows has stack overflows when calling from Tauri, so we increase the default stack size used by the compiler
[target.'cfg(windows)']
rustflags = ["--cfg", "tokio_unstable", "-C", "link-args=/STACK:16777220"]
[target.x86_64-pc-windows-msvc]
linker = "rust-lld"

View File

@@ -18,6 +18,11 @@ jobs:
FORCE_COLOR: 3
# Make cargo nextest successfully ignore projects without tests
NEXTEST_NO_TESTS: pass
# Fail on warnings in CI
# (but don't do this in the root `Cargo.toml`,
# since we don't want warnings to become errors
# while developing)
RUSTFLAGS: -Dwarnings
steps:
- name: 📥 Check out code

View File

@@ -218,10 +218,6 @@ todo = "warn"
unnested_or_patterns = "warn"
wildcard_dependencies = "warn"
[workspace.lints.rust]
# Turn warnings into errors by default
warnings = "deny"
[patch.crates-io]
wry = { git = "https://github.com/modrinth/wry", rev = "f2ce0b0" }

View File

@@ -1010,7 +1010,7 @@ mod tests {
#[test]
fn test_version_sorting() {
let versions = vec![
let versions = [
get_version(4, None, months_ago(6)),
get_version(3, None, months_ago(7)),
get_version(2, Some(1), months_ago(6)),

View File

@@ -73,12 +73,6 @@ pub struct InitialVersionData {
pub ordering: Option<i32>,
}
#[derive(Serialize, Deserialize, Clone)]
struct InitialFileData {
#[serde(default = "HashMap::new")]
pub file_types: HashMap<String, Option<FileType>>,
}
// under `/api/v1/version`
#[post("version")]
pub async fn version_create(

View File

@@ -519,11 +519,14 @@ impl CacheValue {
}
}
#[derive(Deserialize, Serialize, PartialEq, Eq, Debug, Copy, Clone)]
#[derive(
Deserialize, Serialize, PartialEq, Eq, Debug, Copy, Clone, Default,
)]
#[serde(rename_all = "snake_case")]
pub enum CacheBehaviour {
/// Serve expired data. If fetch fails / launcher is offline, errors are ignored
/// and expired data is served
#[default]
StaleWhileRevalidateSkipOffline,
// Serve expired data, revalidate in background
StaleWhileRevalidate,
@@ -533,12 +536,6 @@ pub enum CacheBehaviour {
Bypass,
}
impl Default for CacheBehaviour {
fn default() -> Self {
Self::StaleWhileRevalidateSkipOffline
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CachedEntry {
id: String,

View File

@@ -1,2 +1,9 @@
[toolchain]
channel = "1.89.0"
channel = "nightly-2025-09-18"
profile = "default"
components = [
"rust-analyzer",
# use cranelift in debug builds to improve compile times
# also see `.cargo/config.toml`
"rustc-codegen-cranelift-preview"
]