From 0299ac20f876f43d0520c34d71ef6eb180258cb9 Mon Sep 17 00:00:00 2001 From: oren0e <33298364+oren0e@users.noreply.github.com> Date: Sun, 19 Feb 2023 22:03:32 +0200 Subject: [PATCH] Binary size improvement, update dependencies, update rust toolchain (#12) * Split debug info and bump version * Use rust 1.67.1 in CI * Add rust-toolchain * Upgrade dependencies * Fix clippy lints --- .github/workflows/ci.yml | 24 ++++++++++++------------ Cargo.toml | 14 ++++++++++---- rust-toolchain.toml | 3 +++ src/actions.rs | 6 +++--- src/match_logic.rs | 8 +++----- 5 files changed, 31 insertions(+), 24 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad8d748..71aea1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,15 @@ jobs: name: Rust ${{matrix.rust}} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@1.51.0 - with: - components: clippy, rustfmt - - name: Print rust version - run: rustup show - - name: Print clippy version - run: cargo clippy --version - - name: Lint - run: make lint - - name: Run tests - run: make test + - uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@1.67.1 + with: + components: clippy, rustfmt + - name: Print rust version + run: rustup show + - name: Print clippy version + run: cargo clippy --version + - name: Lint + run: make lint + - name: Run tests + run: make test diff --git a/Cargo.toml b/Cargo.toml index 2bd6a6c..c04b56e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gitopen" -version = "1.3.2" +version = "1.3.3" authors = ["Oren Epshtain"] edition = "2018" license-file = "LICENSE" @@ -18,7 +18,13 @@ exclude = [".github/*", ".gitignore"] [dependencies] -webbrowser = "0.5.5" -anyhow = "1.0.44" -regex = "1.6.0" +webbrowser = "0.8.7" +anyhow = "1.0.69" +regex = "1.7.1" clap = "2.33.3" + +[profile.dev] +split-debuginfo = "unpacked" + +[profile.release] +split-debuginfo = "unpacked" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..6dd863b --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +profile = "default" +channel = "1.67.1" diff --git a/src/actions.rs b/src/actions.rs index 71afc6a..3096fa8 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -9,7 +9,7 @@ use std::process::{Command, Stdio}; // TODO: Add caching (`cached` crate) fn get_parsed_url() -> AnyhowResult { let git_repo = Command::new("git") - .args(&["config", "--get", "remote.origin.url"]) + .args(["config", "--get", "remote.origin.url"]) .stdout(Stdio::piped()) .output()?; @@ -45,13 +45,13 @@ pub fn open_at_line_number(input: &str) -> AnyhowResult<()> { pub fn push_and_open_pr() -> AnyhowResult<()> { let current_branch = Command::new("git") - .args(&["branch", "--show-current"]) + .args(["branch", "--show-current"]) .stdout(Stdio::piped()) .output()?; let current_branch_text = &String::from_utf8(current_branch.stdout)?; let current_branch_text_stripped = current_branch_text.trim(); let output_from_push = Command::new("git") - .args(&["push", "origin", current_branch_text_stripped]) + .args(["push", "origin", current_branch_text_stripped]) .stderr(Stdio::piped()) .output()?; let pr_re = Regex::new(r"remote:.*(https\S*)\s*\n")?; diff --git a/src/match_logic.rs b/src/match_logic.rs index 0f58e99..d3d8188 100644 --- a/src/match_logic.rs +++ b/src/match_logic.rs @@ -45,10 +45,8 @@ pub fn parse_url_from_git(s: &str) -> AnyhowResult { .captures(&url_parts[1]) .ok_or_else(|| anyhow!("Regex error capturing ssh domain"))?; - let result: String = "https://".to_string() - + &match_domain[1].to_string() - + r"/" - + remove_git_suffix(&url_parts[7]); + let result: String = + "https://".to_string() + &match_domain[1] + r"/" + remove_git_suffix(&url_parts[7]); Ok(result) } @@ -83,7 +81,7 @@ pub fn parse_path_and_line_arg(arg: &str, split_char: char) -> AnyhowResult AnyhowResult { let git_branch = Command::new("git") - .args(&["symbolic-ref", "--short", "HEAD"]) + .args(["symbolic-ref", "--short", "HEAD"]) .stdout(Stdio::piped()) .output()?; let stdout = String::from_utf8(git_branch.stdout)?.trim_end().to_string();