rust/hg-core/src/config/config.rs
changeset 46732 60fe9ebae29b
parent 46722 08a35cec14d4
child 46733 1bac7764ceef
equal deleted inserted replaced
46731:3d692e724d06 46732:60fe9ebae29b
   123     fn add_trusted_dir(&mut self, path: &Path) -> Result<(), ConfigError> {
   123     fn add_trusted_dir(&mut self, path: &Path) -> Result<(), ConfigError> {
   124         if let Some(entries) = std::fs::read_dir(path)
   124         if let Some(entries) = std::fs::read_dir(path)
   125             .when_reading_file(path)
   125             .when_reading_file(path)
   126             .io_not_found_as_none()?
   126             .io_not_found_as_none()?
   127         {
   127         {
   128             for entry in entries {
   128             let mut file_paths = entries
   129                 let file_path = entry.when_reading_file(path)?.path();
   129                 .map(|result| {
       
   130                     result.when_reading_file(path).map(|entry| entry.path())
       
   131                 })
       
   132                 .collect::<Result<Vec<_>, _>>()?;
       
   133             file_paths.sort();
       
   134             for file_path in &file_paths {
   130                 if file_path.extension() == Some(std::ffi::OsStr::new("rc")) {
   135                 if file_path.extension() == Some(std::ffi::OsStr::new("rc")) {
   131                     self.add_trusted_file(&file_path)?
   136                     self.add_trusted_file(&file_path)?
   132                 }
   137                 }
   133             }
   138             }
   134         }
   139         }