Skip to content

Commit 2af25b8

Browse files
committed
chore: Shorten Clippy allowance reasons
1 parent 433acfc commit 2af25b8

12 files changed

Lines changed: 48 additions & 141 deletions

File tree

‎src/config/loading/config_builder.rs‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ impl ConfigBuilderLoader {
4242

4343
/// Builds the `ConfigBuilderLoader` and loads configuration from the specified paths.
4444
// https://github.com/vectordotdev/vector/issues/23659
45-
#[allow(
46-
clippy::missing_errors_doc,
47-
reason = "Audit and document the existing error contracts separately from lint enforcement."
48-
)]
45+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
4946
pub fn load_from_paths(
5047
self,
5148
config_paths: &[super::ConfigPath],
@@ -55,10 +52,7 @@ impl ConfigBuilderLoader {
5552

5653
/// Builds the `ConfigBuilderLoader` and loads configuration from an input reader.
5754
// https://github.com/vectordotdev/vector/issues/23659
58-
#[allow(
59-
clippy::missing_errors_doc,
60-
reason = "Audit and document the existing error contracts separately from lint enforcement."
61-
)]
55+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
6256
pub fn load_from_input<R: Read>(
6357
self,
6458
input: R,

‎src/config/loading/interpolation.rs‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ use super::representation::ConfigMap;
99
// https://github.com/vectordotdev/vector/issues/23659
1010
#[allow(
1111
clippy::implicit_hasher,
12-
reason = "Keep the current collection type and API bounds during the lint rollout."
13-
)]
14-
#[allow(
15-
clippy::missing_errors_doc,
16-
reason = "Audit and document the existing error contracts separately from lint enforcement."
12+
reason = "Preserve collection type and API bounds"
1713
)]
14+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
1815
pub fn interpolate_config_map_with_env_vars(
1916
map: &ConfigMap,
2017
vars: &HashMap<String, String>,
@@ -85,12 +82,9 @@ pub static ENVIRONMENT_VARIABLE_INTERPOLATION_REGEX: LazyLock<Regex> = LazyLock:
8582
// https://github.com/vectordotdev/vector/issues/23659
8683
#[allow(
8784
clippy::implicit_hasher,
88-
reason = "Keep the current collection type and API bounds during the lint rollout."
89-
)]
90-
#[allow(
91-
clippy::missing_errors_doc,
92-
reason = "Audit and document the existing error contracts separately from lint enforcement."
85+
reason = "Preserve collection type and API bounds"
9386
)]
87+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
9488
pub fn interpolate(input: &str, vars: &HashMap<String, String>) -> Result<String, Vec<String>> {
9589
let mut errors = Vec::new();
9690

‎src/config/loading/loader.rs‎

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ pub(super) mod process {
7676
/// Helper method used by other methods to recursively handle file/dir loading, merging
7777
/// values against a provided configuration map.
7878
// https://github.com/vectordotdev/vector/issues/23659
79-
#[allow(
80-
clippy::manual_let_else,
81-
reason = "Keep the existing branching and control flow during the lint rollout."
82-
)]
79+
#[allow(clippy::manual_let_else, reason = "Preserve existing control flow")]
8380
#[allow(
8481
clippy::unnecessary_debug_formatting,
85-
reason = "Preserve the existing diagnostic text and escaping behavior."
82+
reason = "Preserve diagnostic text and escaping"
8683
)]
8784
fn load_dir_into(
8885
&mut self,
@@ -230,10 +227,7 @@ where
230227
fn take(self) -> T;
231228

232229
// https://github.com/vectordotdev/vector/issues/23659
233-
#[allow(
234-
clippy::missing_errors_doc,
235-
reason = "Audit and document the existing error contracts separately from lint enforcement."
236-
)]
230+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
237231
fn load_from_str<R: std::io::Read>(
238232
&mut self,
239233
input: R,
@@ -248,10 +242,7 @@ where
248242
/// Deserializes a file with the provided format, and makes the result available via `take`.
249243
/// Returns a vector of non-fatal warnings on success, or a vector of error strings on failure.
250244
// https://github.com/vectordotdev/vector/issues/23659
251-
#[allow(
252-
clippy::missing_errors_doc,
253-
reason = "Audit and document the existing error contracts separately from lint enforcement."
254-
)]
245+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
255246
fn load_from_file(&mut self, path: &Path, format: Format) -> Result<(), Vec<String>> {
256247
if let Some((_, map)) = self.load_file(path, format)? {
257248
self.merge(map, None)?;
@@ -264,10 +255,7 @@ where
264255
/// Deserializes a dir with the provided format, and makes the result available via `take`.
265256
/// Returns a vector of non-fatal warnings on success, or a vector of error strings on failure.
266257
// https://github.com/vectordotdev/vector/issues/23659
267-
#[allow(
268-
clippy::missing_errors_doc,
269-
reason = "Audit and document the existing error contracts separately from lint enforcement."
270-
)]
258+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
271259
fn load_from_dir(&mut self, path: &Path) -> Result<(), Vec<String>> {
272260
// Iterator containing component-specific sub-folders to attempt traversing into.
273261
let hints = [

‎src/config/loading/mod.rs‎

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ static ALLOW_ENV_VAR_INTERPOLATION: OnceLock<bool> = OnceLock::new();
3737
/// Sets whether environment variable interpolation is enabled for the process.
3838
/// Must be called exactly once at startup before any config loading.
3939
// 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-
)]
40+
#[allow(clippy::missing_panics_doc, reason = "Panic documentation deferred")]
4441
pub fn set_env_var_interpolation(allow: bool) {
4542
ALLOW_ENV_VAR_INTERPOLATION
4643
.set(allow)
@@ -99,10 +96,7 @@ pub fn merge_path_lists(
9996
/// Expand a list of paths (potentially containing glob patterns) into real
10097
/// config paths, replacing it with the default paths when empty.
10198
// 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-
)]
99+
#[allow(clippy::missing_panics_doc, reason = "Panic documentation deferred")]
106100
pub fn process_paths(config_paths: &[ConfigPath]) -> Option<Vec<ConfigPath>> {
107101
let starting_paths = if config_paths.is_empty() {
108102
default_config_paths()
@@ -156,10 +150,7 @@ pub fn process_paths(config_paths: &[ConfigPath]) -> Option<Vec<ConfigPath>> {
156150
}
157151

158152
// 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-
)]
153+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
163154
pub fn load_from_paths(config_paths: &[ConfigPath]) -> Result<Config, Vec<String>> {
164155
let builder = ConfigBuilderLoader::default().load_from_paths(config_paths)?;
165156
let (config, build_warnings) = builder.build_with_warnings()?;
@@ -175,10 +166,7 @@ pub fn load_from_paths(config_paths: &[ConfigPath]) -> Result<Config, Vec<String
175166
/// in the builder, the config is used as bootstrapping for a remote source. Otherwise,
176167
/// provider instantiation is skipped.
177168
// 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-
)]
169+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
182170
pub async fn load_from_paths_with_provider_and_secrets(
183171
config_paths: &[ConfigPath],
184172
signal_handler: &mut signal::SignalHandler,
@@ -219,10 +207,7 @@ pub(crate) async fn load_builder_from_paths_with_secrets(
219207
}
220208

221209
// 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-
)]
210+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
226211
pub async fn load_from_str_with_secrets(
227212
input: &str,
228213
format: Format,
@@ -310,21 +295,15 @@ where
310295

311296
/// Uses `SourceLoader` to process `ConfigPaths`, deserializing to a JSON object.
312297
// 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-
)]
298+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
317299
pub fn load_source_from_paths(
318300
config_paths: &[ConfigPath],
319301
) -> Result<serde_json::Map<String, serde_json::Value>, Vec<String>> {
320302
loader_from_paths(SourceLoader::new(), config_paths)
321303
}
322304

323305
// 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-
)]
306+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
328307
pub fn load_from_str(input: &str, format: Format) -> Result<Config, Vec<String>> {
329308
let builder = load_from_inputs(std::iter::once((input.as_bytes(), format)))?;
330309
let (config, build_warnings) = builder.build_with_warnings()?;
@@ -357,10 +336,7 @@ fn load_from_inputs(
357336
}
358337

359338
// 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-
)]
339+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
364340
pub fn prepare_input<R: std::io::Read>(
365341
mut input: R,
366342
interpolate_env: bool,
@@ -390,10 +366,7 @@ pub fn prepare_input<R: std::io::Read>(
390366
}
391367

392368
// 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-
)]
369+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
397370
pub fn load<R: std::io::Read, T>(input: R, format: Format) -> Result<T, Vec<String>>
398371
where
399372
T: serde::de::DeserializeOwned,

‎src/config/loading/representation.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ mod tests {
272272
// https://github.com/vectordotdev/vector/issues/23659
273273
#[allow(
274274
clippy::unnecessary_wraps,
275-
reason = "Preserve the existing return type and caller contracts during the lint rollout."
275+
reason = "Preserve return type and caller contracts"
276276
)]
277277
fn default_optional_value() -> Option<String> {
278278
Some("default".to_string())

‎src/config/loading/schema_coercion.rs‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ impl<'a> ValueCoercer<'a> {
126126

127127
/// Coerces a value in place. On error, some fields may already be coerced.
128128
// https://github.com/vectordotdev/vector/issues/23659
129-
#[allow(
130-
clippy::missing_errors_doc,
131-
reason = "Audit and document the existing error contracts separately from lint enforcement."
132-
)]
129+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
133130
pub fn coerce(&mut self, value: &mut Value) -> Result<(), Error> {
134131
self.path.clear();
135132
self.coerce_value(value, self.schema)
@@ -161,10 +158,7 @@ impl<'a> ValueCoercer<'a> {
161158
}
162159

163160
// https://github.com/vectordotdev/vector/issues/23659
164-
#[allow(
165-
clippy::match_same_arms,
166-
reason = "Keep the existing match structure and branch-specific context during the lint rollout."
167-
)]
161+
#[allow(clippy::match_same_arms, reason = "Preserve branch-specific context")]
168162
fn coerce_value(&mut self, value: &mut Value, schema: &Value) -> Result<(), Error> {
169163
if self.is_unknown_component(value, schema) {
170164
return Ok(());
@@ -940,16 +934,13 @@ impl<'a> ValueCoercer<'a> {
940934
// https://github.com/vectordotdev/vector/issues/23659
941935
#[allow(
942936
clippy::cast_possible_truncation,
943-
reason = "Preserve the existing numeric conversion until its bounds and overflow behavior are audited."
937+
reason = "Bounds and overflow audit deferred"
944938
)]
945939
#[allow(
946940
clippy::cast_precision_loss,
947-
reason = "Preserve the existing numeric conversion and precision until its bounds are audited."
948-
)]
949-
#[allow(
950-
clippy::cast_sign_loss,
951-
reason = "Preserve the existing signed conversion until its input bounds are audited."
941+
reason = "Numeric precision audit deferred"
952942
)]
943+
#[allow(clippy::cast_sign_loss, reason = "Input bounds audit deferred")]
953944
fn coerce_integer(&mut self, value: &mut Value) -> Result<(), Error> {
954945
if let Value::Number(n) = value {
955946
if n.is_i64() || n.is_u64() {

‎src/config/loading/schema_coercion/tests.rs‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ fn generated_enum_aliases_preserve_spelling_and_coerce_payloads() {
185185
// https://github.com/vectordotdev/vector/issues/23659
186186
#[allow(
187187
clippy::needless_pass_by_value,
188-
reason = "Keep ownership and drop timing unchanged during the lint rollout."
188+
reason = "Preserve ownership and drop timing"
189189
)]
190190
fn check<T: vector_config::Configurable + serde::de::DeserializeOwned + 'static>(
191191
input: serde_json::Value,
@@ -478,7 +478,7 @@ fn generated_test_output_preserves_null_conditions() {
478478
// https://github.com/vectordotdev/vector/issues/23659
479479
#[allow(
480480
clippy::cast_precision_loss,
481-
reason = "Preserve the existing numeric conversion and precision until its bounds are audited."
481+
reason = "Numeric precision audit deferred"
482482
)]
483483
fn scalar_coercions() {
484484
for case in [
@@ -563,7 +563,7 @@ fn scalar_coercions() {
563563
// https://github.com/vectordotdev/vector/issues/23659
564564
#[allow(
565565
clippy::cast_precision_loss,
566-
reason = "Preserve the existing numeric conversion and precision until its bounds are audited."
566+
reason = "Numeric precision audit deferred"
567567
)]
568568
fn invalid_scalars_do_not_saturate_or_become_nonfinite() {
569569
for case in [
@@ -783,10 +783,7 @@ fn enum_const_and_boolean_schemas() {
783783

784784
#[test]
785785
// https://github.com/vectordotdev/vector/issues/23659
786-
#[allow(
787-
clippy::too_many_lines,
788-
reason = "Keep the existing control flow intact during the lint rollout."
789-
)]
786+
#[allow(clippy::too_many_lines, reason = "Preserve existing control flow")]
790787
fn enum_and_const_share_scalar_conversions_but_keep_distinct_errors() {
791788
// Run each conversion against both a constant and a single-value enum.
792789
struct ConstraintCase {
@@ -940,7 +937,7 @@ fn generated_unsigned_integer_accepts_integral_float_above_signed_range() {
940937
// https://github.com/vectordotdev/vector/issues/23659
941938
#[allow(
942939
clippy::cast_precision_loss,
943-
reason = "Preserve the existing numeric conversion and precision until its bounds are audited."
940+
reason = "Numeric precision audit deferred"
944941
)]
945942
fn generated_signed_integer_leaves_unsigned_overflow_for_serde() {
946943
let schema =
@@ -1108,10 +1105,7 @@ mod test {
11081105

11091106
#[test]
11101107
// https://github.com/vectordotdev/vector/issues/23659
1111-
#[allow(
1112-
clippy::too_many_lines,
1113-
reason = "Keep the existing control flow intact during the lint rollout."
1114-
)]
1108+
#[allow(clippy::too_many_lines, reason = "Preserve existing control flow")]
11151109
fn test_coercion_with_array_support() {
11161110
let mut input = json!({
11171111
"proxy": {

‎src/config/loading/secret.rs‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl Loader<SecretBackendLoader> for SecretBackendLoader {
138138
// https://github.com/vectordotdev/vector/issues/23659
139139
#[allow(
140140
clippy::implicit_hasher,
141-
reason = "Keep the current collection type and API bounds during the lint rollout."
141+
reason = "Preserve collection type and API bounds"
142142
)]
143143
pub fn collect_secret_keys_from_map(map: &ConfigMap, keys: &mut HashMap<String, HashSet<String>>) {
144144
fn visit(value: &serde_json::Value, keys: &mut HashMap<String, HashSet<String>>) {
@@ -162,12 +162,9 @@ pub fn collect_secret_keys_from_map(map: &ConfigMap, keys: &mut HashMap<String,
162162
// https://github.com/vectordotdev/vector/issues/23659
163163
#[allow(
164164
clippy::implicit_hasher,
165-
reason = "Keep the current collection type and API bounds during the lint rollout."
166-
)]
167-
#[allow(
168-
clippy::missing_errors_doc,
169-
reason = "Audit and document the existing error contracts separately from lint enforcement."
165+
reason = "Preserve collection type and API bounds"
170166
)]
167+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
171168
pub fn interpolate_config_map_with_secrets(
172169
map: &ConfigMap,
173170
secrets: &HashMap<String, String>,
@@ -193,16 +190,10 @@ fn collect_secret_keys(input: &str, keys: &mut HashMap<String, HashSet<String>>)
193190
// https://github.com/vectordotdev/vector/issues/23659
194191
#[allow(
195192
clippy::implicit_hasher,
196-
reason = "Keep the current collection type and API bounds during the lint rollout."
197-
)]
198-
#[allow(
199-
clippy::missing_errors_doc,
200-
reason = "Audit and document the existing error contracts separately from lint enforcement."
201-
)]
202-
#[allow(
203-
clippy::missing_panics_doc,
204-
reason = "Audit and document the existing panic conditions separately from lint enforcement."
193+
reason = "Preserve collection type and API bounds"
205194
)]
195+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
196+
#[allow(clippy::missing_panics_doc, reason = "Panic documentation deferred")]
206197
pub fn interpolate(input: &str, secrets: &HashMap<String, String>) -> Result<String, Vec<String>> {
207198
let mut errors = Vec::<String>::new();
208199
let output = COLLECTOR

‎src/config/sink.rs‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,8 @@ where
109109
/// always present (filled in during config compilation) and the sink is built
110110
/// through the `DynValidatedSink` boundary.
111111
// https://github.com/vectordotdev/vector/issues/23659
112-
#[allow(
113-
clippy::missing_errors_doc,
114-
reason = "Audit and document the existing error contracts separately from lint enforcement."
115-
)]
116-
#[allow(
117-
clippy::missing_panics_doc,
118-
reason = "Audit and document the existing panic conditions separately from lint enforcement."
119-
)]
112+
#[allow(clippy::missing_errors_doc, reason = "Error documentation deferred")]
113+
#[allow(clippy::missing_panics_doc, reason = "Panic documentation deferred")]
120114
pub async fn build(&self, cx: SinkContext) -> crate::Result<(VectorSink, Healthcheck)> {
121115
let validated = self
122116
.validated
@@ -339,7 +333,7 @@ impl Default for SinkContext {
339333
// https://github.com/vectordotdev/vector/issues/23659
340334
#[allow(
341335
clippy::default_trait_access,
342-
reason = "Keep inferred defaults where concrete type names need a separate import or API cleanup."
336+
reason = "Preserve inferred default types"
343337
)]
344338
fn default() -> Self {
345339
Self {

0 commit comments

Comments
 (0)