Skip to content

Commit b56193e

Browse files
lukesteensenbruceg
andauthored
chore: upgrade to rust 1.66.0 (vectordotdev#15093)
* chore: upgrade to rust 1.65.0 Signed-off-by: Luke Steensen <[email protected]> * Fix bool-to-int clippy lint * Fix another lint * bump to 1.66.0 Signed-off-by: Luke Steensen <[email protected]> * clippy fixes Signed-off-by: Luke Steensen <[email protected]> * clippy build.rs Signed-off-by: Luke Steensen <[email protected]> * more fixes Signed-off-by: Luke Steensen <[email protected]> * map_or with identity is unwrap_or Signed-off-by: Luke Steensen <[email protected]> Signed-off-by: Luke Steensen <[email protected]> Co-authored-by: Bruce Guenter <[email protected]>
1 parent 95f2f3a commit b56193e

File tree

181 files changed

+503
-549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+503
-549
lines changed

.cargo/config.toml

+4
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ rustflags = ["-C", "link-args=-rdynamic"]
2424

2525
[target.aarch64-unknown-linux-gnu]
2626
rustflags = ["-C", "link-args=-rdynamic"]
27+
28+
[target.x86_64-pc-windows-msvc]
29+
# https://github.com/dtolnay/inventory/issues/58
30+
rustflags = ["-C", "codegen-units=1"]

Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "README.md"
1010
publish = false
1111
default-run = "vector"
1212
autobenches = false # our benchmarks are not runnable on their own either way
13-
rust-version = "1.64.0"
13+
rust-version = "1.66.0"
1414

1515
[[bin]]
1616
name = "vector"
@@ -34,9 +34,6 @@ path = "src/config/loading/secret_backend_example.rs"
3434
test = false
3535
bench = false
3636

37-
[profile.dev]
38-
split-debuginfo = "unpacked" # Faster debug builds on macOS
39-
4037
# CI-based builds use full release optimization. See scripts/environment/release-flags.sh.
4138
# This results in roughly a 5% reduction in performance when compiling locally vs when
4239
# compiled via the CI pipeline.

Tiltfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ load('ext://helm_resource', 'helm_resource', 'helm_repo')
77
docker_build(
88
ref='timberio/vector',
99
context='.',
10-
build_args={'RUST_VERSION': '1.64'},
10+
build_args={'RUST_VERSION': '1.66'},
1111
dockerfile='tilt/Dockerfile'
1212
)
1313

build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl BuildConstants {
7171
let base_dir = env::var("OUT_DIR").expect("OUT_DIR not present in build script!");
7272
let dest_path = Path::new(&base_dir).join(file_name);
7373

74-
let mut output_file = File::create(&dest_path)?;
74+
let mut output_file = File::create(dest_path)?;
7575
output_file.write_all(
7676
"// AUTOGENERATED CONSTANTS. SEE BUILD.RS AT REPOSITORY ROOT. DO NOT MODIFY.\n"
7777
.as_ref(),
@@ -108,7 +108,7 @@ fn main() {
108108
println!("cargo:rerun-if-changed=proto/vector.proto");
109109

110110
let mut prost_build = prost_build::Config::new();
111-
prost_build.btree_map(&["."]);
111+
prost_build.btree_map(["."]);
112112

113113
tonic_build::configure()
114114
.protoc_arg("--experimental_allow_proto3_optional")

lib/datadog/grok/src/grok.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'a> Iterator for MatchesIter<'a> {
6464
// that index, if anything.
6565
self.names.next().map(|(k, v)| {
6666
let key = k.as_str();
67-
let value = self.captures.at(*v as usize).unwrap_or("");
67+
let value = self.captures.at(*v).unwrap_or("");
6868
(key, value)
6969
})
7070
}

lib/file-source/src/file_server.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ where
114114
}
115115

116116
existing_files.sort_by_key(|(path, _file_id)| {
117-
fs::metadata(&path)
117+
fs::metadata(path)
118118
.and_then(|m| m.created())
119119
.map(DateTime::<Utc>::from)
120120
.unwrap_or_else(|_| Utc::now())
@@ -206,8 +206,8 @@ where
206206
);
207207
let (old_path, new_path) = (&watcher.path, &path);
208208
if let (Ok(old_modified_time), Ok(new_modified_time)) = (
209-
fs::metadata(&old_path).and_then(|m| m.modified()),
210-
fs::metadata(&new_path).and_then(|m| m.modified()),
209+
fs::metadata(old_path).and_then(|m| m.modified()),
210+
fs::metadata(new_path).and_then(|m| m.modified()),
211211
) {
212212
if old_modified_time < new_modified_time {
213213
info!(

lib/file-source/src/fingerprinter.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ mod test {
249249
let full_line_path = target_dir.path().join("full_line.log");
250250
let duplicate_path = target_dir.path().join("duplicate.log");
251251
let not_full_line_path = target_dir.path().join("not_full_line.log");
252-
fs::write(&empty_path, &[]).unwrap();
252+
fs::write(&empty_path, []).unwrap();
253253
fs::write(&full_line_path, &full_line_data).unwrap();
254254
fs::write(&duplicate_path, &full_line_data).unwrap();
255-
fs::write(&not_full_line_path, &not_full_line_data).unwrap();
255+
fs::write(&not_full_line_path, not_full_line_data).unwrap();
256256

257257
let mut buf = Vec::new();
258258
assert!(fingerprinter
@@ -417,8 +417,8 @@ mod test {
417417
let small_path = target_dir.path().join("small.log");
418418
let medium_path = target_dir.path().join("medium.log");
419419
let duplicate_path = target_dir.path().join("duplicate.log");
420-
fs::write(&empty_path, &[]).unwrap();
421-
fs::write(&small_path, &small_data).unwrap();
420+
fs::write(&empty_path, []).unwrap();
421+
fs::write(&small_path, small_data).unwrap();
422422
fs::write(&medium_path, &medium_data).unwrap();
423423
fs::write(&duplicate_path, &medium_data).unwrap();
424424

lib/k8s-test-framework/src/namespace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl up_down::CommandBuilder for CommandBuilder {
4747
up_down::CommandToBuild::Down => "delete",
4848
})
4949
.arg("--filename")
50-
.arg(&self.config.test_namespace_resource_file.path());
50+
.arg(self.config.test_namespace_resource_file.path());
5151

5252
if matches!(command_to_build, up_down::CommandToBuild::Down) {
5353
// We don't need a graceful shutdown

lib/lookup/src/lookup_buf/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl Serialize for LookupBuf {
314314
where
315315
S: Serializer,
316316
{
317-
serializer.serialize_str(&*ToString::to_string(self))
317+
serializer.serialize_str(&ToString::to_string(self))
318318
}
319319
}
320320

lib/lookup/src/lookup_v2/jit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a> Iterator for JitValuePathIter<'a> {
286286
self.coalesce_count += 1;
287287
(
288288
Some(Some(BorrowedSegment::CoalesceField(Cow::Borrowed(
289-
&self.path[(start as usize)..(end as usize)],
289+
&self.path[start..end],
290290
)))),
291291
JitState::CoalesceStart,
292292
)
@@ -298,7 +298,7 @@ impl<'a> Iterator for JitValuePathIter<'a> {
298298
self.coalesce_count = 0;
299299
(
300300
Some(Some(BorrowedSegment::CoalesceEnd(Cow::Borrowed(
301-
&self.path[(start as usize)..(end as usize)],
301+
&self.path[start..end],
302302
)))),
303303
JitState::Continue,
304304
)

lib/lookup/src/lookup_view/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl<'a> Serialize for Lookup<'a> {
280280
where
281281
S: Serializer,
282282
{
283-
serializer.serialize_str(&*self.to_string())
283+
serializer.serialize_str(&self.to_string())
284284
}
285285
}
286286

lib/lookup/src/lookup_view/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn lookup_to_string_and_serialize() {
238238
.for_each(|fixture_file| match fixture_file {
239239
Ok(fixture_file) => {
240240
let path = fixture_file.path();
241-
let buf = parse_artifact(&path).unwrap();
241+
let buf = parse_artifact(path).unwrap();
242242

243243
let buf_serialized =
244244
serde_json::to_string(&serde_json::to_value(&buf).unwrap()).unwrap();

lib/prometheus-parser/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ fn main() {
22
println!("cargo:rerun-if-changed=proto/prometheus-remote.proto");
33
println!("cargo:rerun-if-changed=proto/prometheus-types.proto");
44
let mut prost_build = prost_build::Config::new();
5-
prost_build.btree_map(&["."]);
5+
prost_build.btree_map(["."]);
66
// It would be nice to just add these derives to all the types, but
77
// prost automatically adds them already to enums, which causes the
88
// extra derives to conflict with itself.

lib/value/src/kind/collection.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ mod tests {
514514
},
515515
),
516516
]) {
517-
assert_eq!(this.is_superset(&other).is_ok(), want, "{}", title);
517+
assert_eq!(this.is_superset(&other).is_ok(), want, "{title}");
518518
}
519519
}
520520

@@ -693,7 +693,7 @@ mod tests {
693693
),
694694
] {
695695
this.merge(other, strategy);
696-
assert_eq!(this, want, "{}", title);
696+
assert_eq!(this, want, "{title}");
697697
}
698698
}
699699

@@ -778,7 +778,7 @@ mod tests {
778778
]) {
779779
this.anonymize();
780780

781-
assert_eq!(this, want, "{}", title);
781+
assert_eq!(this, want, "{title}");
782782
}
783783
}
784784

@@ -837,7 +837,7 @@ mod tests {
837837
},
838838
),
839839
]) {
840-
assert_eq!(this.to_string(), want.to_string(), "{}", title);
840+
assert_eq!(this.to_string(), want.to_string(), "{title}");
841841
}
842842
}
843843

@@ -893,7 +893,7 @@ mod tests {
893893
},
894894
),
895895
]) {
896-
assert_eq!(this.to_string(), want.to_string(), "{}", title);
896+
assert_eq!(this.to_string(), want.to_string(), "{title}");
897897
}
898898
}
899899

@@ -948,7 +948,7 @@ mod tests {
948948
},
949949
),
950950
]) {
951-
assert_eq!(this.reduced_kind(), want, "{}", title);
951+
assert_eq!(this.reduced_kind(), want, "{title}");
952952
}
953953
}
954954
}

lib/value/src/kind/collection/exact.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ mod tests {
299299
},
300300
),
301301
]) {
302-
assert_eq!(this.is_superset(&other), want, "{}", title);
302+
assert_eq!(this.is_superset(&other), want, "{title}");
303303
}
304304
}
305305
}

lib/value/src/kind/collection/unknown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ mod tests {
409409
},
410410
),
411411
]) {
412-
assert_eq!(this.is_superset(&other).is_ok(), want, "{}", title);
412+
assert_eq!(this.is_superset(&other).is_ok(), want, "{title}");
413413
}
414414
}
415415
}

lib/value/src/kind/comparison.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ mod tests {
532532
},
533533
),
534534
]) {
535-
assert_eq!(this.is_superset(&other).is_ok(), want, "{}", title);
535+
assert_eq!(this.is_superset(&other).is_ok(), want, "{title}");
536536
}
537537
}
538538

@@ -622,7 +622,7 @@ mod tests {
622622
},
623623
),
624624
]) {
625-
assert_eq!(kind.is_exact(), want, "{}", title);
625+
assert_eq!(kind.is_exact(), want, "{title}");
626626
}
627627
}
628628
}

lib/value/src/kind/conversion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ mod tests {
142142
},
143143
),
144144
]) {
145-
assert_eq!(kind.to_primitives(), want, "{}", title);
145+
assert_eq!(kind.to_primitives(), want, "{title}");
146146
}
147147
}
148148
}

lib/value/src/kind/crud/get.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ mod tests {
467467
},
468468
),
469469
] {
470-
assert_eq!(kind.at_path(&path), want, "test: {}", title);
470+
assert_eq!(kind.at_path(&path), want, "test: {title}");
471471
}
472472
}
473473
}

lib/value/src/kind/crud/insert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ mod tests {
751751
),
752752
] {
753753
this.insert(&path, kind);
754-
assert_eq!(this, expected, "{}", title);
754+
assert_eq!(this, expected, "{title}");
755755
}
756756
}
757757
}

lib/value/src/kind/crud/remove.rs

+14-18
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ impl Kind {
4949

5050
self.as_object_mut()
5151
.map_or(CompactOptions::Never, |object| {
52-
match object.known_mut().get_mut(&Field::from(field.clone())) {
53-
None => {
54-
// The modified value is discarded here (It's not needed)
55-
&mut at_path_kind
56-
}
57-
Some(child) => child,
58-
}
59-
.remove_inner(&segments[1..], compact)
60-
.compact(object, field.clone(), compact)
52+
// The modified value is discarded here (It's not needed)
53+
object
54+
.known_mut()
55+
.get_mut(&Field::from(field.clone()))
56+
.unwrap_or(&mut at_path_kind)
57+
.remove_inner(&segments[1..], compact)
58+
.compact(object, field.clone(), compact)
6159
})
6260
}
6361

@@ -104,15 +102,13 @@ impl Kind {
104102
}
105103
}
106104

107-
match array.known_mut().get_mut(&(index as usize).into()) {
108-
None => {
109-
// The modified value is discarded here (It's not needed)
110-
&mut at_path_kind
111-
}
112-
Some(child) => child,
113-
}
114-
.remove_inner(&segments[1..], compact)
115-
.compact(array, index as usize, compact)
105+
// The modified value is discarded here (It's not needed)
106+
array
107+
.known_mut()
108+
.get_mut(&(index as usize).into())
109+
.unwrap_or(&mut at_path_kind)
110+
.remove_inner(&segments[1..], compact)
111+
.compact(array, index as usize, compact)
116112
} else {
117113
// guaranteed to not delete anything
118114
CompactOptions::Never

lib/value/src/kind/debug.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ fn insert_unknown(
8282
insert_kind(&mut unknown_tree, &unknown, unknown_exact);
8383
if unknown.is_exact() {
8484
tree.insert(
85-
format!("{}_unknown_exact", prefix),
85+
format!("{prefix}_unknown_exact"),
8686
Value::Object(unknown_tree),
8787
);
8888
} else {
8989
tree.insert(
90-
format!("{}_unknown_infinite", prefix),
90+
format!("{prefix}_unknown_infinite"),
9191
Value::Object(unknown_tree),
9292
);
9393
}

lib/value/src/kind/merge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ mod tests {
268268
),
269269
]) {
270270
this.merge(other, strategy);
271-
assert_eq!(this, merged, "{}", title);
271+
assert_eq!(this, merged, "{title}");
272272
}
273273
}
274274
}

lib/value/src/value/convert.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,7 @@ impl From<Cow<'_, str>> for Value {
311311

312312
impl<T: Into<Self>> From<Option<T>> for Value {
313313
fn from(value: Option<T>) -> Self {
314-
match value {
315-
None => Self::Null,
316-
Some(v) => v.into(),
317-
}
314+
value.map_or(Self::Null, Into::into)
318315
}
319316
}
320317

lib/value/src/value/crud/remove.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ mod test {
109109
];
110110

111111
for (query, expected_first, expected_second) in &queries {
112-
assert_eq!(value.remove(*query, false), *expected_first, "{}", query);
113-
assert_eq!(value.remove(*query, false), *expected_second, "{}", query);
112+
assert_eq!(value.remove(*query, false), *expected_first, "{query}");
113+
assert_eq!(value.remove(*query, false), *expected_second, "{query}");
114114
}
115115

116116
assert_eq!(

0 commit comments

Comments
 (0)