Skip to content

Commit

Permalink
Return impl Iterator instead of Vec
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Oct 28, 2020
1 parent 3c01125 commit c39c730
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,14 @@ impl Cfg {
Toolchain::from(self, name)
}

pub fn get_toolchains_from_regex(&self, regex: Regex) -> Result<Vec<Toolchain<'_>>> {
pub fn get_toolchains_from_regex(
&self,
regex: Regex,
) -> Result<impl Itererator<Item = Toolchain<'_>>> {
Ok(self
.list_toolchains_iter()?
.filter(|toolchain| regex.is_match(toolchain))
.map(|toolchain| Toolchain::from(self, &toolchain).unwrap())
.collect())
.map(|toolchain| Toolchain::from(self, &toolchain).unwrap()))
}

pub fn verify_toolchain(&self, name: &str) -> Result<Toolchain<'_>> {
Expand Down

0 comments on commit c39c730

Please sign in to comment.