Skip to content

Commit

Permalink
chore: resolve regex loop clippy warning (#2812)
Browse files Browse the repository at this point in the history
* chore: resolve regex loop clippy warning

* Commit from GitHub Actions (test)

---------

Co-authored-by: mise[bot] <[email protected]>
  • Loading branch information
jdx and mise-en-dev authored Oct 25, 2024
1 parent 7fe56ea commit 1e3cbc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cli/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ impl Registry {
settings::ensure_experimental("registry")?;
let mut tools = BTreeMap::new();

let re = regex!(r#"^https://github.com/(.+?/.+?)(.git)?$"#);
for (plugin, url) in Config::get().get_shorthands() {
let re = regex!(r#"^https://github.com/(.+?/.+?)(.git)?$"#);
let full = if let Some(caps) = re.captures(url) {
format!("asdf:{}", &caps[1])
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/core/ruby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ impl RubyPlugin {

fn fetch_patches(&self) -> Result<String> {
let mut patches = vec![];
let re = regex!(r#"^[Hh][Tt][Tt][Pp][Ss]?://"#);
for f in &self.fetch_patch_sources() {
if regex!(r#"^[Hh][Tt][Tt][Pp][Ss]?://"#).is_match(f) {
if re.is_match(f) {
patches.push(HTTP.get_text(f)?);
} else {
patches.push(file::read_to_string(f)?);
Expand Down
3 changes: 2 additions & 1 deletion src/runtime_symlinks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ fn list_symlinks(config: &Config, backend: Arc<dyn Backend>) -> Result<IndexMap<
// TODO: make this a pure function and add test cases
let mut symlinks = IndexMap::new();
let rel_path = |x: &String| PathBuf::from(".").join(x.clone());
let re = regex!(r"^[a-zA-Z0-9]+-");
for v in installed_versions(&backend)? {
let prefix = regex!(r"^[a-zA-Z0-9]+-")
let prefix = re
.find(&v)
.map(|s| s.as_str().to_string())
.unwrap_or_default();
Expand Down

0 comments on commit 1e3cbc3

Please sign in to comment.