Skip to content

Commit 764a8ac

Browse files
authored
feat: improve release profile (#145)
Closes #144
1 parent 7879b68 commit 764a8ac

File tree

9 files changed

+207
-213
lines changed

9 files changed

+207
-213
lines changed

Cargo.lock

Lines changed: 141 additions & 184 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,28 @@ license = "MIT OR Apache-2.0"
1515
repository = "https://github.com/alloy-rs/svm-rs"
1616
homepage = "https://github.com/alloy-rs/svm-rs"
1717

18+
[workspace.lints.clippy]
19+
dbg-macro = "warn"
20+
manual-string-new = "warn"
21+
uninlined-format-args = "warn"
22+
use-self = "warn"
23+
redundant-clone = "warn"
24+
missing-const-for-fn = "warn"
25+
needless-return = "allow"
26+
27+
[workspace.lints.rust]
28+
# missing-copy-implementations = "warn"
29+
# missing-debug-implementations = "warn"
30+
# missing-docs = "warn"
31+
rust-2018-idioms = "warn"
32+
# unreachable-pub = "warn"
33+
unused-must-use = "warn"
34+
redundant-lifetimes = "warn"
35+
unnameable-types = "warn"
36+
37+
[workspace.lints.rustdoc]
38+
all = "warn"
39+
1840
[workspace.dependencies]
1941
svm = { package = "svm-rs", version = "0.5.7", path = "crates/svm-rs", default-features = false }
2042

@@ -23,3 +45,9 @@ semver = "1"
2345
serde = "1"
2446
serde_json = "1"
2547
reqwest = { version = "0.12", default-features = false, features = ["socks"] }
48+
49+
[profile.release]
50+
lto = "fat"
51+
debug = 0
52+
strip = "debuginfo"
53+
codegen-units = 1

crates/svm-builds/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ license.workspace = true
1010
repository.workspace = true
1111
homepage.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[build-dependencies]
14-
svm = { workspace = true, default-features = false, features = ["blocking", "rustls"] }
17+
svm = { workspace = true, default-features = false, features = [
18+
"blocking",
19+
"rustls",
20+
] }
1521

1622
build_const = "0.2"
1723
hex.workspace = true

crates/svm-builds/build.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ fn add_platform_const(writer: &mut build_const::ConstValueWriter, platform: svm:
114114
writer.add_raw(&format!(
115115
r#"
116116
/// The `svm::Platform` all constants were built for
117-
pub const TARGET_PLATFORM: &str = "{}";
118-
"#,
119-
platform
117+
pub const TARGET_PLATFORM: &str = "{platform}";
118+
"#
120119
));
121120
}
122121

@@ -125,17 +124,11 @@ fn generate() {
125124

126125
let releases: Releases = if let Ok(file_path) = std::env::var(SVM_RELEASES_LIST_JSON) {
127126
let file = File::open(file_path).unwrap_or_else(|_| {
128-
panic!(
129-
"{:?} defined, but cannot read the file referenced",
130-
SVM_RELEASES_LIST_JSON
131-
)
127+
panic!("{SVM_RELEASES_LIST_JSON:?} defined, but cannot read the file referenced")
132128
});
133129

134130
serde_json::from_reader(file).unwrap_or_else(|_| {
135-
panic!(
136-
"Failed to parse the JSON from {:?} file",
137-
SVM_RELEASES_LIST_JSON
138-
)
131+
panic!("Failed to parse the JSON from {SVM_RELEASES_LIST_JSON:?} file")
139132
})
140133
} else {
141134
svm::blocking_all_releases(platform).expect("Failed to fetch releases")

crates/svm-rs/Cargo.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ license.workspace = true
1010
repository.workspace = true
1111
homepage.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[lib]
1417
name = "svm"
1518

@@ -24,10 +27,14 @@ path = "src/bin/solc/main.rs"
2427
required-features = ["solc"]
2528

2629
[build-dependencies]
27-
vergen = { version = "8", optional = true, features = ["build", "git", "gitcl"] }
30+
vergen = { version = "8", optional = true, features = [
31+
"build",
32+
"git",
33+
"gitcl",
34+
] }
2835

2936
[dependencies]
30-
fs4 = "0.9"
37+
fs4 = "0.10"
3138
hex.workspace = true
3239
dirs = "5.0"
3340
reqwest = { workspace = true, default-features = false, features = ["json"] }
@@ -46,7 +53,10 @@ console = { version = "0.15", default-features = false, optional = true }
4653
dialoguer = { version = "0.11", default-features = false, optional = true }
4754
indicatif = { version = "0.17", default-features = false, optional = true }
4855
itertools = { version = "0.13", optional = true }
49-
tokio = { version = "1", features = ["rt-multi-thread", "macros"], optional = true }
56+
tokio = { version = "1", features = [
57+
"rt-multi-thread",
58+
"macros",
59+
], optional = true }
5060

5161
[target.'cfg(all(target_os = "windows", target_arch = "x86_64"))'.dependencies]
5262
zip = { version = "2", default-features = false, features = ["deflate"] }

crates/svm-rs/src/bin/solc/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() {
1616
let code = match main_() {
1717
Ok(code) => code,
1818
Err(err) => {
19-
eprintln!("svm: error: {err:?}");
19+
eprintln!("svm: error: {err}");
2020
1
2121
}
2222
};

crates/svm-rs/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mod platform;
2929
pub use platform::{platform, Platform};
3030

3131
mod releases;
32-
pub use releases::{all_releases, Releases};
32+
pub use releases::{all_releases, BuildInfo, Releases};
3333

3434
#[cfg(feature = "blocking")]
3535
pub use releases::blocking_all_releases;

crates/svm-rs/src/platform.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ pub enum Platform {
1616
impl fmt::Display for Platform {
1717
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
1818
let s = match self {
19-
Platform::LinuxAmd64 => "linux-amd64",
20-
Platform::LinuxAarch64 => "linux-aarch64",
21-
Platform::MacOsAmd64 => "macosx-amd64",
22-
Platform::MacOsAarch64 => "macosx-aarch64",
23-
Platform::WindowsAmd64 => "windows-amd64",
24-
Platform::Unsupported => "Unsupported-platform",
19+
Self::LinuxAmd64 => "linux-amd64",
20+
Self::LinuxAarch64 => "linux-aarch64",
21+
Self::MacOsAmd64 => "macosx-amd64",
22+
Self::MacOsAarch64 => "macosx-aarch64",
23+
Self::WindowsAmd64 => "windows-amd64",
24+
Self::Unsupported => "Unsupported-platform",
2525
};
2626
f.write_str(s)
2727
}
@@ -32,11 +32,11 @@ impl FromStr for Platform {
3232

3333
fn from_str(s: &str) -> Result<Self, Self::Err> {
3434
match s {
35-
"linux-amd64" => Ok(Platform::LinuxAmd64),
36-
"linux-aarch64" => Ok(Platform::LinuxAarch64),
37-
"macosx-amd64" => Ok(Platform::MacOsAmd64),
38-
"macosx-aarch64" => Ok(Platform::MacOsAarch64),
39-
"windows-amd64" => Ok(Platform::WindowsAmd64),
35+
"linux-amd64" => Ok(Self::LinuxAmd64),
36+
"linux-aarch64" => Ok(Self::LinuxAarch64),
37+
"macosx-amd64" => Ok(Self::MacOsAmd64),
38+
"macosx-aarch64" => Ok(Self::MacOsAarch64),
39+
"windows-amd64" => Ok(Self::WindowsAmd64),
4040
s => Err(format!("unsupported platform {s}")),
4141
}
4242
}

crates/svm-rs/src/releases.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ mod tests {
317317
.await
318318
.expect("could not fetch releases for macos-aarch64");
319319
let rosetta = Version::new(0, 8, 4);
320-
let native = MACOS_AARCH64_NATIVE.clone();
320+
let native = MACOS_AARCH64_NATIVE;
321321
let url1 = artifact_url(
322322
Platform::MacOsAarch64,
323323
&rosetta,

0 commit comments

Comments
 (0)