@@ -25,7 +25,7 @@ impl Command {
2525 /// Run the constructed command and assert that it is successfully run.
2626 #[ track_caller]
2727 pub fn run ( & mut self ) -> CompletedProcess {
28- let caller_location = :: std:: panic:: Location :: caller ( ) ;
28+ let caller_location = std:: panic:: Location :: caller ( ) ;
2929 let caller_line_number = caller_location. line ( ) ;
3030
3131 let output = self . command_output ( ) ;
@@ -38,7 +38,7 @@ impl Command {
3838 /// Run the constructed command and assert that it does not successfully run.
3939 #[ track_caller]
4040 pub fn run_fail ( & mut self ) -> CompletedProcess {
41- let caller_location = :: std:: panic:: Location :: caller ( ) ;
41+ let caller_location = std:: panic:: Location :: caller ( ) ;
4242 let caller_line_number = caller_location. line ( ) ;
4343
4444 let output = self . command_output ( ) ;
@@ -107,33 +107,33 @@ impl CompletedProcess {
107107
108108 /// Checks that trimmed `stdout` matches trimmed `content`.
109109 #[ track_caller]
110- pub fn assert_stdout_equals ( self , content : & str ) -> Self {
111- assert_eq ! ( self . stdout_utf8( ) . trim( ) , content. trim( ) ) ;
110+ pub fn assert_stdout_equals < S : AsRef < str > > ( self , content : S ) -> Self {
111+ assert_eq ! ( self . stdout_utf8( ) . trim( ) , content. as_ref ( ) . trim( ) ) ;
112112 self
113113 }
114114
115115 #[ track_caller]
116- pub fn assert_stdout_not_contains ( self , needle : & str ) -> Self {
117- assert_not_contains ( & self . stdout_utf8 ( ) , needle) ;
116+ pub fn assert_stdout_not_contains < S : AsRef < str > > ( self , needle : S ) -> Self {
117+ assert_not_contains ( & self . stdout_utf8 ( ) , needle. as_ref ( ) ) ;
118118 self
119119 }
120120
121121 /// Checks that trimmed `stderr` matches trimmed `content`.
122122 #[ track_caller]
123- pub fn assert_stderr_equals ( self , content : & str ) -> Self {
124- assert_eq ! ( self . stderr_utf8( ) . trim( ) , content. trim( ) ) ;
123+ pub fn assert_stderr_equals < S : AsRef < str > > ( self , content : S ) -> Self {
124+ assert_eq ! ( self . stderr_utf8( ) . trim( ) , content. as_ref ( ) . trim( ) ) ;
125125 self
126126 }
127127
128128 #[ track_caller]
129- pub fn assert_stderr_contains ( self , needle : & str ) -> Self {
130- assert ! ( self . stderr_utf8( ) . contains( needle) ) ;
129+ pub fn assert_stderr_contains < S : AsRef < str > > ( self , needle : S ) -> Self {
130+ assert ! ( self . stderr_utf8( ) . contains( needle. as_ref ( ) ) ) ;
131131 self
132132 }
133133
134134 #[ track_caller]
135- pub fn assert_stderr_not_contains ( self , needle : & str ) -> Self {
136- assert_not_contains ( & self . stdout_utf8 ( ) , needle) ;
135+ pub fn assert_stderr_not_contains < S : AsRef < str > > ( self , needle : S ) -> Self {
136+ assert_not_contains ( & self . stdout_utf8 ( ) , needle. as_ref ( ) ) ;
137137 self
138138 }
139139
0 commit comments