1+ #![ warn( clippy:: pedantic) ]
2+
13mod config_builder;
24pub ( crate ) mod interpolation;
35mod loader;
@@ -34,6 +36,11 @@ static ALLOW_ENV_VAR_INTERPOLATION: OnceLock<bool> = OnceLock::new();
3436
3537/// Sets whether environment variable interpolation is enabled for the process.
3638/// Must be called exactly once at startup before any config loading.
39+ // https://github.com/vectordotdev/vector/issues/23659
40+ #[ allow(
41+ clippy:: missing_panics_doc,
42+ reason = "Audit and document the existing panic conditions separately from lint enforcement."
43+ ) ]
3744pub fn set_env_var_interpolation ( allow : bool ) {
3845 ALLOW_ENV_VAR_INTERPOLATION
3946 . set ( allow)
@@ -56,7 +63,7 @@ pub(super) fn component_name<P: AsRef<Path> + Debug>(path: P) -> Result<String,
5663 path. as_ref ( )
5764 . file_stem ( )
5865 . and_then ( |name| name. to_str ( ) )
59- . map ( |name| name . to_string ( ) )
66+ . map ( std :: string :: ToString :: to_string)
6067 . ok_or_else ( || vec ! [ format!( "Couldn't get component name for file: {path:?}" ) ] )
6168}
6269
@@ -91,11 +98,16 @@ pub fn merge_path_lists(
9198
9299/// Expand a list of paths (potentially containing glob patterns) into real
93100/// config paths, replacing it with the default paths when empty.
101+ // https://github.com/vectordotdev/vector/issues/23659
102+ #[ allow(
103+ clippy:: missing_panics_doc,
104+ reason = "Audit and document the existing panic conditions separately from lint enforcement."
105+ ) ]
94106pub fn process_paths ( config_paths : & [ ConfigPath ] ) -> Option < Vec < ConfigPath > > {
95- let starting_paths = if !config_paths. is_empty ( ) {
96- config_paths. to_owned ( )
97- } else {
107+ let starting_paths = if config_paths. is_empty ( ) {
98108 default_config_paths ( )
109+ } else {
110+ config_paths. to_owned ( )
99111 } ;
100112
101113 let mut paths = Vec :: new ( ) ;
@@ -125,7 +137,7 @@ pub fn process_paths(config_paths: &[ConfigPath]) -> Option<Vec<ConfigPath>> {
125137 }
126138 ConfigPath :: Dir ( _) => {
127139 for path in matches {
128- paths. push ( ConfigPath :: Dir ( path) )
140+ paths. push ( ConfigPath :: Dir ( path) ) ;
129141 }
130142 }
131143 }
@@ -143,6 +155,11 @@ pub fn process_paths(config_paths: &[ConfigPath]) -> Option<Vec<ConfigPath>> {
143155 Some ( paths)
144156}
145157
158+ // https://github.com/vectordotdev/vector/issues/23659
159+ #[ allow(
160+ clippy:: missing_errors_doc,
161+ reason = "Audit and document the existing error contracts separately from lint enforcement."
162+ ) ]
146163pub fn load_from_paths ( config_paths : & [ ConfigPath ] ) -> Result < Config , Vec < String > > {
147164 let builder = ConfigBuilderLoader :: default ( ) . load_from_paths ( config_paths) ?;
148165 let ( config, build_warnings) = builder. build_with_warnings ( ) ?;
@@ -157,6 +174,11 @@ pub fn load_from_paths(config_paths: &[ConfigPath]) -> Result<Config, Vec<String
157174/// Loads a configuration from paths. Handle secret replacement and if a provider is present
158175/// in the builder, the config is used as bootstrapping for a remote source. Otherwise,
159176/// provider instantiation is skipped.
177+ // https://github.com/vectordotdev/vector/issues/23659
178+ #[ allow(
179+ clippy:: missing_errors_doc,
180+ reason = "Audit and document the existing error contracts separately from lint enforcement."
181+ ) ]
160182pub async fn load_from_paths_with_provider_and_secrets (
161183 config_paths : & [ ConfigPath ] ,
162184 signal_handler : & mut signal:: SignalHandler ,
@@ -196,6 +218,11 @@ pub(crate) async fn load_builder_from_paths_with_secrets(
196218 . load_from_paths ( config_paths)
197219}
198220
221+ // https://github.com/vectordotdev/vector/issues/23659
222+ #[ allow(
223+ clippy:: missing_errors_doc,
224+ reason = "Audit and document the existing error contracts separately from lint enforcement."
225+ ) ]
199226pub async fn load_from_str_with_secrets (
200227 input : & str ,
201228 format : Format ,
@@ -240,7 +267,7 @@ where
240267 L : Loader < T > + Process ,
241268 R : std:: io:: Read ,
242269{
243- loader. load_from_str ( input, format) . map ( |_ | loader. take ( ) )
270+ loader. load_from_str ( input, format) . map ( |( ) | loader. take ( ) )
244271}
245272
246273/// Iterators over `ConfigPaths`, and processes a file/dir according to a provided `Loader`.
@@ -265,14 +292,12 @@ where
265292 ) {
266293 Ok ( ( ) ) => { }
267294 Err ( errs) => errors. extend ( errs) ,
268- } ;
269- }
270- ConfigPath :: Dir ( path) => {
271- match loader. load_from_dir ( path) {
272- Ok ( ( ) ) => { }
273- Err ( errs) => errors. extend ( errs) ,
274- } ;
295+ }
275296 }
297+ ConfigPath :: Dir ( path) => match loader. load_from_dir ( path) {
298+ Ok ( ( ) ) => { }
299+ Err ( errs) => errors. extend ( errs) ,
300+ } ,
276301 }
277302 }
278303
@@ -284,12 +309,22 @@ where
284309}
285310
286311/// Uses `SourceLoader` to process `ConfigPaths`, deserializing to a JSON object.
312+ // https://github.com/vectordotdev/vector/issues/23659
313+ #[ allow(
314+ clippy:: missing_errors_doc,
315+ reason = "Audit and document the existing error contracts separately from lint enforcement."
316+ ) ]
287317pub fn load_source_from_paths (
288318 config_paths : & [ ConfigPath ] ,
289319) -> Result < serde_json:: Map < String , serde_json:: Value > , Vec < String > > {
290320 loader_from_paths ( SourceLoader :: new ( ) , config_paths)
291321}
292322
323+ // https://github.com/vectordotdev/vector/issues/23659
324+ #[ allow(
325+ clippy:: missing_errors_doc,
326+ reason = "Audit and document the existing error contracts separately from lint enforcement."
327+ ) ]
293328pub fn load_from_str ( input : & str , format : Format ) -> Result < Config , Vec < String > > {
294329 let builder = load_from_inputs ( std:: iter:: once ( ( input. as_bytes ( ) , format) ) ) ?;
295330 let ( config, build_warnings) = builder. build_with_warnings ( ) ?;
@@ -310,7 +345,7 @@ fn load_from_inputs(
310345 for ( input, format) in inputs {
311346 if let Err ( errs) = load ( input, format) . and_then ( |n| config. append ( n) ) {
312347 // TODO: add back paths
313- errors. extend ( errs. iter ( ) . map ( |e| e . to_string ( ) ) ) ;
348+ errors. extend ( errs. iter ( ) . cloned ( ) ) ;
314349 }
315350 }
316351
@@ -321,6 +356,11 @@ fn load_from_inputs(
321356 }
322357}
323358
359+ // https://github.com/vectordotdev/vector/issues/23659
360+ #[ allow(
361+ clippy:: missing_errors_doc,
362+ reason = "Audit and document the existing error contracts separately from lint enforcement."
363+ ) ]
324364pub fn prepare_input < R : std:: io:: Read > (
325365 mut input : R ,
326366 interpolate_env : bool ,
@@ -349,6 +389,11 @@ pub fn prepare_input<R: std::io::Read>(
349389 }
350390}
351391
392+ // https://github.com/vectordotdev/vector/issues/23659
393+ #[ allow(
394+ clippy:: missing_errors_doc,
395+ reason = "Audit and document the existing error contracts separately from lint enforcement."
396+ ) ]
352397pub fn load < R : std:: io:: Read , T > ( input : R , format : Format ) -> Result < T , Vec < String > >
353398where
354399 T : serde:: de:: DeserializeOwned ,
0 commit comments