Skip to content

Commit

Permalink
add optimizations for size and speed (#4)
Browse files Browse the repository at this point in the history
* add optimizations in root

* fix clippy

* remove release from lib

* fix clippy

* fmt

---------

Co-authored-by: Konstantinos Athanasiou <[email protected]>
  • Loading branch information
dinosath and Konstantinos Athanasiou authored Jan 9, 2025
1 parent b6f8a7f commit 6f43bb2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
12 changes: 5 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ members = ["protypo","protypo-cli"]
exclude = ["output"]
resolver = "2"

[profile.release]
strip = true

[profile.dev.package.insta]
opt-level = 3

[profile.dev.package.similar]
opt-level = 3

# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"
[profile.release]
codegen-units = 1
lto = true
strip = true
debug = false
panic = "abort"
6 changes: 0 additions & 6 deletions protypo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ edition = "2021"
license = "MIT"
description = "A library for code generation using rrgen and jinja like templates."

[profile.release]
opt-level = 3
lto = "fat"
panic = "abort"
strip = "symbols"

[dependencies]
futures = "0.3"
glob = "0.3"
Expand Down
4 changes: 2 additions & 2 deletions protypo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ impl Generator {
let rrgen = RRgen::with_templates(templates).map_err(|err| {
std::io::Error::new(
std::io::ErrorKind::Other,
format!("Could not initialize rrgen, due to error: {:?}", err),
format!("Could not initialize rrgen, due to error: {err:?}"),
)
})?;

Expand Down Expand Up @@ -461,7 +461,7 @@ async fn download_and_extract_to_temp(url: Url) -> Result<PathBuf, io::Error> {
let cursor = Cursor::new(bytes);
if std::path::Path::new(&url.to_string())
.extension()
.map_or(false, |ext| ext.eq_ignore_ascii_case("zip"))
.is_some_and(|ext| ext.eq_ignore_ascii_case("zip"))
|| url.to_string().ends_with(".tar.gz")
{
let mut zip = ZipArchive::new(cursor)?;
Expand Down

0 comments on commit 6f43bb2

Please sign in to comment.