summaryrefslogtreecommitdiffstats
path: root/src/modules/rust.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/rust.rs')
-rw-r--r--src/modules/rust.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/modules/rust.rs b/src/modules/rust.rs
index b18692b82..e11fa4301 100644
--- a/src/modules/rust.rs
+++ b/src/modules/rust.rs
@@ -1,4 +1,3 @@
-use std::ffi::OsStr;
use std::path::Path;
use std::process::{Command, Output};
use std::{env, fs};
@@ -107,13 +106,11 @@ fn find_rust_toolchain_file(context: &Context) -> Option<String> {
Some(line.trim().to_owned())
}
- if let Some(path) = context
- .get_dir_files()
- .ok()?
- .iter()
- .find(|p| p.file_name() == Some(OsStr::new("rust-toolchain")))
+ if let Ok(true) = context
+ .dir_contents()
+ .map(|dir| dir.has_file("rust-toolchain"))
{
- if let Some(toolchain) = read_first_line(path) {
+ if let Some(toolchain) = read_first_line(Path::new("rust-toolchain")) {
return Some(toolchain);
}
}