Skip to content

Commit c39c730

Browse files
committed
Return impl Iterator instead of Vec
1 parent 3c01125 commit c39c730

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/config.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,14 @@ impl Cfg {
364364
Toolchain::from(self, name)
365365
}
366366

367-
pub fn get_toolchains_from_regex(&self, regex: Regex) -> Result<Vec<Toolchain<'_>>> {
367+
pub fn get_toolchains_from_regex(
368+
&self,
369+
regex: Regex,
370+
) -> Result<impl Itererator<Item = Toolchain<'_>>> {
368371
Ok(self
369372
.list_toolchains_iter()?
370373
.filter(|toolchain| regex.is_match(toolchain))
371-
.map(|toolchain| Toolchain::from(self, &toolchain).unwrap())
372-
.collect())
374+
.map(|toolchain| Toolchain::from(self, &toolchain).unwrap()))
373375
}
374376

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

0 commit comments

Comments
 (0)