@@ -12,7 +12,7 @@ use itertools::{Either, Itertools};
1212use once_cell:: sync:: Lazy ;
1313use rayon:: prelude:: * ;
1414
15- use crate :: config:: { Config , MatchesProfile , Plugin , Shell , Template } ;
15+ use crate :: config:: { Config , MatchesProfile , Plugin , Shell } ;
1616use crate :: context:: Context ;
1717pub use crate :: lock:: file:: LockedConfig ;
1818use crate :: lock:: file:: { LockedExternalPlugin , LockedPlugin } ;
@@ -86,8 +86,9 @@ pub fn config(ctx: &Context, config: Config) -> Result<LockedConfig> {
8686 . push ( ( index, plugin) ) ;
8787 }
8888
89- let matches = & matches. as_ref ( ) . unwrap_or_else ( || shell. default_matches ( ) ) ;
90- #[ allow( clippy:: redundant_closure) ]
89+ let matches = matches
90+ . as_deref ( )
91+ . unwrap_or_else ( || shell. default_matches ( ) ) ;
9192 let apply = apply. as_ref ( ) . unwrap_or_else ( || Shell :: default_apply ( ) ) ;
9293 let count = map. len ( ) ;
9394 let mut errors = Vec :: new ( ) ;
@@ -117,9 +118,8 @@ pub fn config(ctx: &Context, config: Config) -> Result<LockedConfig> {
117118 let mut locked = Vec :: with_capacity ( plugins. len ( ) ) ;
118119 for ( index, plugin) in plugins {
119120 let name = plugin. name . clone ( ) ;
120- let plugin =
121- plugin:: lock ( ctx, & templates, source. clone ( ) , matches, apply, plugin)
122- . with_context ( s ! ( "failed to install plugin `{}`" , name) ) ;
121+ let plugin = plugin:: lock ( ctx, source. clone ( ) , matches, apply, plugin)
122+ . with_context ( s ! ( "failed to install plugin `{}`" , name) ) ;
123123 locked. push ( ( index, plugin) ) ;
124124 }
125125 Ok ( locked)
@@ -171,7 +171,7 @@ pub fn config(ctx: &Context, config: Config) -> Result<LockedConfig> {
171171
172172impl Shell {
173173 /// The default files to match on for this shell.
174- fn default_matches ( & self ) -> & Vec < String > {
174+ fn default_matches ( & self ) -> & [ String ] {
175175 static DEFAULT_MATCHES_BASH : Lazy < Vec < String > > = Lazy :: new ( || {
176176 vec_into ! [
177177 "{{ name }}.plugin.bash" ,
@@ -203,19 +203,19 @@ impl Shell {
203203 }
204204
205205 /// The default templates for this shell.
206- pub fn default_templates ( & self ) -> & IndexMap < String , Template > {
207- static DEFAULT_TEMPLATES_BASH : Lazy < IndexMap < String , Template > > = Lazy :: new ( || {
206+ pub fn default_templates ( & self ) -> & IndexMap < String , String > {
207+ static DEFAULT_TEMPLATES_BASH : Lazy < IndexMap < String , String > > = Lazy :: new ( || {
208208 indexmap_into ! {
209209 "PATH" => "export PATH=\" {{ dir }}:$PATH\" " ,
210- "source" => Template :: from ( " source \" {{ file }}\" " ) . each ( true )
210+ "source" => "{% for file in files %} source \" {{ file }}\" \n {% endfor %}"
211211 }
212212 } ) ;
213- static DEFAULT_TEMPLATES_ZSH : Lazy < IndexMap < String , Template > > = Lazy :: new ( || {
213+ static DEFAULT_TEMPLATES_ZSH : Lazy < IndexMap < String , String > > = Lazy :: new ( || {
214214 indexmap_into ! {
215215 "PATH" => "export PATH=\" {{ dir }}:$PATH\" " ,
216216 "path" => "path=( \" {{ dir }}\" $path )" ,
217217 "fpath" => "fpath=( \" {{ dir }}\" $fpath )" ,
218- "source" => Template :: from ( " source \" {{ file }}\" " ) . each ( true )
218+ "source" => "{% for file in files %} source \" {{ file }}\" \n {% endfor %}"
219219 }
220220 } ) ;
221221 match self {
@@ -231,14 +231,6 @@ impl Shell {
231231 }
232232}
233233
234- impl Template {
235- /// Set whether this template should be applied to every file.
236- fn each ( mut self , each : bool ) -> Self {
237- self . each = each;
238- self
239- }
240- }
241-
242234impl LockedConfig {
243235 /// Verify that the `LockedConfig` is okay.
244236 pub fn verify ( & self , ctx : & Context ) -> bool {
0 commit comments