Skip to content

Commit

Permalink
chore: take out creating regex from loop
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelramos committed Oct 14, 2024
1 parent f1f9fd7 commit 4b3602d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/workspace_std/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ impl Repository {
local: Option<bool>,
) -> GitResult<Vec<RepositoryRemoteTags>> {
let mut args = vec![];
let regex = Regex::new(r"\s+").expect("Failed to create regex");

match local {
Some(true) => {
Expand Down Expand Up @@ -385,7 +386,7 @@ impl Repository {
.split(LINE_ENDING)
.filter(|tags| !tags.trim().is_empty())
.map(|tags| {
let hash_tags = Regex::new(r"\s+").unwrap().split(tags).collect::<Vec<&str>>();
let hash_tags = regex.split(tags).collect::<Vec<&str>>();

RepositoryRemoteTags {
hash: hash_tags[0].to_string(),
Expand Down

0 comments on commit 4b3602d

Please sign in to comment.