@@ -168,16 +168,15 @@ pub type Command = (SimpleCommand, Option<Box<[String]>>);
168168
169169/// A type that is specific to 'only commands', that can only happen in "Defaults!command" contexts;
170170/// which is essentially a subset of "Command"
171- #[ cfg( feature = "rust-glob" ) ]
172- pub type SimpleCommand = glob:: Pattern ;
173- #[ cfg( not( feature = "rust-glob" ) ) ]
174- pub struct SimpleCommand ( SudoString ) ;
171+ pub struct SimpleCommand ( <SimpleCommand as std:: ops:: Deref >:: Target ) ;
175172
176- #[ cfg( not( feature = "rust-glob" ) ) ]
177173impl std:: ops:: Deref for SimpleCommand {
174+ #[ cfg( feature = "rust-glob" ) ]
175+ type Target = glob:: Pattern ;
176+ #[ cfg( not( feature = "rust-glob" ) ) ]
178177 type Target = SudoString ;
179178
180- fn deref ( & self ) -> & SudoString {
179+ fn deref ( & self ) -> & Self :: Target {
181180 & self . 0
182181 }
183182}
@@ -238,7 +237,9 @@ impl Token for SimpleCommand {
238237 fn construct ( mut cmd : String ) -> Result < Self , String > {
239238 #[ cfg( feature = "rust-glob" ) ]
240239 let make_pattern = |pat : String | {
241- glob:: Pattern :: new ( & pat) . map_err ( |err| format ! ( "wildcard pattern error {err}" ) )
240+ glob:: Pattern :: new ( & pat)
241+ . map ( SimpleCommand )
242+ . map_err ( |_| "wildcard pattern error" . to_string ( ) )
242243 } ;
243244
244245 #[ cfg( not( feature = "rust-glob" ) ) ]
0 commit comments