@@ -6,14 +6,14 @@ use std::{
66 path:: { Path , PathBuf } ,
77} ;
88
9- use error_stack:: { Context , Result } ;
9+ use error_stack:: { Context , Result , ResultExt } ;
1010
1111use ignore:: WalkBuilder ;
1212use rayon:: prelude:: { IntoParallelIterator , ParallelIterator } ;
1313use regex:: Regex ;
1414use tracing:: { info, instrument} ;
1515
16- use crate :: { config:: Config , error_stack_ext :: IntoContext } ;
16+ use crate :: config:: Config ;
1717use glob_match:: glob_match;
1818
1919pub struct Project {
@@ -163,10 +163,10 @@ impl Project {
163163 let walkdir = builder. build ( ) ;
164164
165165 for entry in walkdir {
166- let entry = entry. into_context ( Error :: Io ) ?;
166+ let entry = entry. change_context ( Error :: Io ) ?;
167167
168168 let absolute_path = entry. path ( ) ;
169- let relative_path = absolute_path. strip_prefix ( base_path) . into_context ( Error :: Io ) ?. to_owned ( ) ;
169+ let relative_path = absolute_path. strip_prefix ( base_path) . change_context ( Error :: Io ) ?. to_owned ( ) ;
170170
171171 if entry. file_type ( ) . unwrap ( ) . is_dir ( ) {
172172 if relative_path. parent ( ) == Some ( Path :: new ( & config. vendored_gems_path ) ) {
@@ -205,7 +205,7 @@ impl Project {
205205 }
206206
207207 if file_name. eq_ignore_ascii_case ( ".codeowner" ) {
208- let owner = std:: fs:: read_to_string ( absolute_path) . into_context ( Error :: Io ) ?;
208+ let owner = std:: fs:: read_to_string ( absolute_path) . change_context ( Error :: Io ) ?;
209209 let owner = owner. trim ( ) . to_owned ( ) ;
210210
211211 let relative_path = relative_path. to_owned ( ) ;
@@ -216,8 +216,8 @@ impl Project {
216216 }
217217
218218 if matches_globs ( & relative_path, & config. team_file_glob ) {
219- let file = File :: open ( absolute_path) . into_context ( Error :: Io ) ?;
220- let deserializer: deserializers:: Team = serde_yaml:: from_reader ( file) . into_context ( Error :: SerdeYaml ) ?;
219+ let file = File :: open ( absolute_path) . change_context ( Error :: Io ) ?;
220+ let deserializer: deserializers:: Team = serde_yaml:: from_reader ( file) . change_context ( Error :: SerdeYaml ) ?;
221221
222222 teams. push ( Team {
223223 path : absolute_path. to_owned ( ) ,
@@ -243,7 +243,7 @@ impl Project {
243243 ) ;
244244
245245 let codeowners_file: String = if codeowners_file_path. exists ( ) {
246- std:: fs:: read_to_string ( codeowners_file_path) . into_context ( Error :: Io ) ?
246+ std:: fs:: read_to_string ( codeowners_file_path) . change_context ( Error :: Io ) ?
247247 } else {
248248 "" . to_owned ( )
249249 } ;
@@ -326,15 +326,15 @@ fn owned_files(owned_file_paths: Vec<PathBuf>) -> Vec<ProjectFile> {
326326}
327327
328328fn ruby_package_owner ( path : & Path ) -> Result < Option < String > , Error > {
329- let file = File :: open ( path) . into_context ( Error :: Io ) ?;
330- let deserializer: deserializers:: RubyPackage = serde_yaml:: from_reader ( file) . into_context ( Error :: SerdeYaml ) ?;
329+ let file = File :: open ( path) . change_context ( Error :: Io ) ?;
330+ let deserializer: deserializers:: RubyPackage = serde_yaml:: from_reader ( file) . change_context ( Error :: SerdeYaml ) ?;
331331
332332 Ok ( deserializer. owner )
333333}
334334
335335fn javascript_package_owner ( path : & Path ) -> Result < Option < String > , Error > {
336- let file = File :: open ( path) . into_context ( Error :: Io ) ?;
337- let deserializer: deserializers:: JavascriptPackage = serde_json:: from_reader ( file) . into_context ( Error :: SerdeJson ) ?;
336+ let file = File :: open ( path) . change_context ( Error :: Io ) ?;
337+ let deserializer: deserializers:: JavascriptPackage = serde_json:: from_reader ( file) . change_context ( Error :: SerdeJson ) ?;
338338
339339 Ok ( deserializer. metadata . and_then ( |metadata| metadata. owner ) )
340340}
0 commit comments