@@ -964,7 +964,7 @@ impl<SE: extensions::ShellExtensions> Shell<SE> {
964964 /// * `path` - The path to the file to source.
965965 /// * `args` - The arguments to pass to the script as positional parameters.
966966 /// * `params` - Execution parameters.
967- pub async fn source_script < S : AsRef < str > , P : AsRef < Path > , I : Iterator < Item = S > > (
967+ pub async fn source_script < S : Into < String > , P : AsRef < Path > , I : Iterator < Item = S > > (
968968 & mut self ,
969969 path : P ,
970970 args : I ,
@@ -987,7 +987,11 @@ impl<SE: extensions::ShellExtensions> Shell<SE> {
987987 /// * `args` - The arguments to pass to the script as positional parameters.
988988 /// * `params` - Execution parameters.
989989 /// * `call_type` - The type of script call being made.
990- async fn parse_and_execute_script_file < S : AsRef < str > , P : AsRef < Path > , I : Iterator < Item = S > > (
990+ async fn parse_and_execute_script_file <
991+ S : Into < String > ,
992+ P : AsRef < Path > ,
993+ I : Iterator < Item = S > ,
994+ > (
991995 & mut self ,
992996 path : P ,
993997 args : I ,
@@ -1040,7 +1044,7 @@ impl<SE: extensions::ShellExtensions> Shell<SE> {
10401044 /// * `args` - The arguments to pass to the script as positional parameters.
10411045 /// * `params` - Execution parameters.
10421046 /// * `call_type` - The type of script call being made.
1043- async fn source_file < F : Read , S : AsRef < str > , I : Iterator < Item = S > > (
1047+ async fn source_file < F : Read , S : Into < String > , I : Iterator < Item = S > > (
10441048 & mut self ,
10451049 file : F ,
10461050 source_info : & crate :: SourceInfo ,
@@ -1054,7 +1058,7 @@ impl<SE: extensions::ShellExtensions> Shell<SE> {
10541058 tracing:: debug!( target: trace_categories:: PARSE , "Parsing sourced file: {}" , source_info. source) ;
10551059 let parse_result = parser. parse_program ( ) ;
10561060
1057- let script_positional_args = args. map ( |s| s . as_ref ( ) . to_owned ( ) ) ;
1061+ let script_positional_args = args. map ( Into :: into ) ;
10581062
10591063 self . call_stack
10601064 . push_script ( call_type, source_info, script_positional_args) ;
@@ -1195,7 +1199,7 @@ impl<SE: extensions::ShellExtensions> Shell<SE> {
11951199 ///
11961200 /// * `script_path` - The path to the script file to execute.
11971201 /// * `args` - The arguments to pass to the script as positional parameters.
1198- pub async fn run_script < S : AsRef < str > , P : AsRef < Path > , I : Iterator < Item = S > > (
1202+ pub async fn run_script < S : Into < String > , P : AsRef < Path > , I : Iterator < Item = S > > (
11991203 & mut self ,
12001204 script_path : P ,
12011205 args : I ,
@@ -1690,15 +1694,16 @@ impl<SE: extensions::ShellExtensions> Shell<SE> {
16901694 /// # Arguments
16911695 ///
16921696 /// * `candidate_name` - The name of the file to look for.
1693- pub fn find_first_executable_in_path_using_cache < S : AsRef < str > > (
1697+ pub fn find_first_executable_in_path_using_cache < T : Into < String > > (
16941698 & mut self ,
1695- candidate_name : S ,
1699+ candidate_name : T ,
16961700 ) -> Option < PathBuf > {
1701+ let candidate_name = candidate_name. into ( ) ;
16971702 if let Some ( cached_path) = self . program_location_cache . get ( & candidate_name) {
16981703 Some ( cached_path)
16991704 } else if let Some ( found_path) = self . find_first_executable_in_path ( & candidate_name) {
17001705 self . program_location_cache
1701- . set ( & candidate_name, found_path. clone ( ) ) ;
1706+ . set ( candidate_name, found_path. clone ( ) ) ;
17021707 Some ( found_path)
17031708 } else {
17041709 None
0 commit comments