Skip to content

Commit

Permalink
chore(deps): Bump Rust to 1.75.0 (vectordotdev#19518)
Browse files Browse the repository at this point in the history
* bump rust ver

* clippy clip clip clip lib

* clippy clip cliperoo src

* windowwwwwwwwwwwwwwwwwwwwwwwwwwwwwws

* just allow it

* add back panic expectation

* fix issues with lint on ConfigTargetPath
  • Loading branch information
neuronull authored and AndrooTheChen committed Sep 23, 2024
1 parent 4d0aee2 commit bfa6e52
Show file tree
Hide file tree
Showing 52 changed files with 245 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load('ext://helm_resource', 'helm_resource', 'helm_repo')
docker_build(
ref='timberio/vector',
context='.',
build_args={'RUST_VERSION': '1.72.1'},
build_args={'RUST_VERSION': '1.75.0'},
dockerfile='tilt/Dockerfile'
)

Expand Down
2 changes: 1 addition & 1 deletion lib/codecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ chrono = { version = "0.4", default-features = false }
csv-core = { version = "0.1.10", default-features = false }
derivative = { version = "2", default-features = false }
dyn-clone = { version = "1", default-features = false }
lookup = { package = "vector-lookup", path = "../vector-lookup", default-features = false }
lookup = { package = "vector-lookup", path = "../vector-lookup", default-features = false, features = ["test"] }
memchr = { version = "2", default-features = false }
once_cell = { version = "1.19", default-features = false }
ordered-float = { version = "4.2.0", default-features = false }
Expand Down
38 changes: 19 additions & 19 deletions lib/codecs/src/encoding/format/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ mod tests {
let mut tree = ObjectMap::new();

for (field_name, field_value) in field_data.into_iter() {
let field = ConfigTargetPath::try_from(field_name).unwrap();
let field = field_name.into();
fields.push(field);

let field_value = Value::from(field_value.to_string());
Expand Down Expand Up @@ -351,15 +351,15 @@ mod tests {
"other" => Value::from("data"),
}));
let fields = vec![
ConfigTargetPath::try_from("foo".to_string()).unwrap(),
ConfigTargetPath::try_from("int".to_string()).unwrap(),
ConfigTargetPath::try_from("comma".to_string()).unwrap(),
ConfigTargetPath::try_from("float".to_string()).unwrap(),
ConfigTargetPath::try_from("missing".to_string()).unwrap(),
ConfigTargetPath::try_from("space".to_string()).unwrap(),
ConfigTargetPath::try_from("time".to_string()).unwrap(),
ConfigTargetPath::try_from("quote".to_string()).unwrap(),
ConfigTargetPath::try_from("bool".to_string()).unwrap(),
"foo".into(),
"int".into(),
"comma".into(),
"float".into(),
"missing".into(),
"space".into(),
"time".into(),
"quote".into(),
"bool".into(),
];

let opts = CsvSerializerOptions {
Expand Down Expand Up @@ -388,11 +388,11 @@ mod tests {
"field5" => Value::from("value5"),
}));
let fields = vec![
ConfigTargetPath::try_from("field1".to_string()).unwrap(),
ConfigTargetPath::try_from("field5".to_string()).unwrap(),
ConfigTargetPath::try_from("field5".to_string()).unwrap(),
ConfigTargetPath::try_from("field3".to_string()).unwrap(),
ConfigTargetPath::try_from("field2".to_string()).unwrap(),
"field1".into(),
"field5".into(),
"field5".into(),
"field3".into(),
"field2".into(),
];
let opts = CsvSerializerOptions {
fields,
Expand All @@ -419,10 +419,10 @@ mod tests {
"field4" => Value::from("baz,bas"),
}));
let fields = vec![
ConfigTargetPath::try_from("field1".to_string()).unwrap(),
ConfigTargetPath::try_from("field2".to_string()).unwrap(),
ConfigTargetPath::try_from("field3".to_string()).unwrap(),
ConfigTargetPath::try_from("field4".to_string()).unwrap(),
"field1".into(),
"field2".into(),
"field3".into(),
"field4".into(),
];

let mut default_bytes = BytesMut::new();
Expand Down
2 changes: 1 addition & 1 deletion lib/dnsmsg-parser/src/dns_message_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl DnsMessageParser {
.collect::<Vec<ZoneInfo>>();

zones
.get(0)
.first()
.cloned()
.ok_or_else(|| DnsMessageParserError::SimpleError {
cause: format!(
Expand Down
2 changes: 1 addition & 1 deletion lib/prometheus-parser/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl MetricGroup {
}

fn matching_group<T: Default>(values: &mut MetricMap<T>, group: GroupKey) -> &mut T {
values.entry(group).or_insert_with(T::default)
values.entry(group).or_default()
}

/// Parse the given text input, and group the result into higher-level
Expand Down
32 changes: 16 additions & 16 deletions lib/vector-buffers/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,19 @@ mod test {

#[test]
fn parse_partial_invalid_keys() {
let source = r#"max_size: 100
let source = r"max_size: 100
max_events: 42
"#;
";
let error = serde_yaml::from_str::<BufferConfig>(source).unwrap_err();
assert_eq!(error.to_string(), BUFFER_CONFIG_NO_MATCH_ERR);
}

#[test]
fn parse_without_type_tag() {
check_single_stage(
r#"
r"
max_events: 100
"#,
",
BufferType::Memory {
max_events: NonZeroUsize::new(100).unwrap(),
when_full: WhenFull::Block,
Expand All @@ -448,11 +448,11 @@ max_events: 42
#[test]
fn parse_multiple_stages() {
check_multiple_stages(
r#"
r"
- max_events: 42
- max_events: 100
when_full: drop_newest
"#,
",
&[
BufferType::Memory {
max_events: NonZeroUsize::new(42).unwrap(),
Expand All @@ -469,53 +469,53 @@ max_events: 42
#[test]
fn ensure_field_defaults_for_all_types() {
check_single_stage(
r#"
r"
type: memory
"#,
",
BufferType::Memory {
max_events: NonZeroUsize::new(500).unwrap(),
when_full: WhenFull::Block,
},
);

check_single_stage(
r#"
r"
type: memory
max_events: 100
"#,
",
BufferType::Memory {
max_events: NonZeroUsize::new(100).unwrap(),
when_full: WhenFull::Block,
},
);

check_single_stage(
r#"
r"
type: memory
when_full: drop_newest
"#,
",
BufferType::Memory {
max_events: NonZeroUsize::new(500).unwrap(),
when_full: WhenFull::DropNewest,
},
);

check_single_stage(
r#"
r"
type: memory
when_full: overflow
"#,
",
BufferType::Memory {
max_events: NonZeroUsize::new(500).unwrap(),
when_full: WhenFull::Overflow,
},
);

check_single_stage(
r#"
r"
type: disk
max_size: 1024
"#,
",
BufferType::DiskV2 {
max_size: NonZeroU64::new(1024).unwrap(),
when_full: WhenFull::Block,
Expand Down
4 changes: 2 additions & 2 deletions lib/vector-buffers/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl<T: FixedEncodable> Encodable for T {

fn get_metadata() -> Self::Metadata {}

fn can_decode(_: Self::Metadata) -> bool {
fn can_decode((): Self::Metadata) -> bool {
true
}

Expand All @@ -189,7 +189,7 @@ impl<T: FixedEncodable> Encodable for T {
FixedEncodable::encoded_size(self)
}

fn decode<B: Buf + Clone>(_: Self::Metadata, buffer: B) -> Result<Self, Self::DecodeError> {
fn decode<B: Buf + Clone>((): Self::Metadata, buffer: B) -> Result<Self, Self::DecodeError> {
<Self as FixedEncodable>::decode(buffer)
}
}
8 changes: 2 additions & 6 deletions lib/vector-buffers/src/test/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,8 @@ impl Arbitrary for Variant {
let use_memory_buffer = bool::arbitrary(g);

// Using a u16 ensures we avoid any allocation errors for our holding buffers, etc.
let max_events = NonZeroU16::arbitrary(g)
.try_into()
.expect("we don't support 16-bit platforms");
let max_size = NonZeroU16::arbitrary(g)
.try_into()
.expect("we don't support 16-bit platforms");
let max_events = NonZeroU16::arbitrary(g).into();
let max_size = NonZeroU16::arbitrary(g).into();

let when_full = WhenFull::arbitrary(g);

Expand Down
2 changes: 1 addition & 1 deletion lib/vector-buffers/src/topology/acks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ mod tests {
}

#[test]
#[should_panic]
#[should_panic(expected = "overflowing unclaimed acknowledgements is a serious bug")]
fn panic_when_unclaimed_acks_overflows() {
let actions = vec![Action::Acknowledge(u64::MAX), Action::Acknowledge(1)];

Expand Down
6 changes: 3 additions & 3 deletions lib/vector-buffers/src/topology/channel/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub enum ReceiverAdapter<T: Bufferable> {
InMemory(LimitedReceiver<T>),

/// The disk v2 buffer.
DiskV2(disk_v2::Reader<T, ProductionFilesystem>),
DiskV2(disk_v2::BufferReader<T, ProductionFilesystem>),
}

impl<T: Bufferable> From<LimitedReceiver<T>> for ReceiverAdapter<T> {
Expand All @@ -33,8 +33,8 @@ impl<T: Bufferable> From<LimitedReceiver<T>> for ReceiverAdapter<T> {
}
}

impl<T: Bufferable> From<disk_v2::Reader<T, ProductionFilesystem>> for ReceiverAdapter<T> {
fn from(v: disk_v2::Reader<T, ProductionFilesystem>) -> Self {
impl<T: Bufferable> From<disk_v2::BufferReader<T, ProductionFilesystem>> for ReceiverAdapter<T> {
fn from(v: disk_v2::BufferReader<T, ProductionFilesystem>) -> Self {
Self::DiskV2(v)
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/vector-buffers/src/topology/channel/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum SenderAdapter<T: Bufferable> {
InMemory(LimitedSender<T>),

/// The disk v2 buffer.
DiskV2(Arc<Mutex<disk_v2::Writer<T, ProductionFilesystem>>>),
DiskV2(Arc<Mutex<disk_v2::BufferWriter<T, ProductionFilesystem>>>),
}

impl<T: Bufferable> From<LimitedSender<T>> for SenderAdapter<T> {
Expand All @@ -30,8 +30,8 @@ impl<T: Bufferable> From<LimitedSender<T>> for SenderAdapter<T> {
}
}

impl<T: Bufferable> From<disk_v2::Writer<T, ProductionFilesystem>> for SenderAdapter<T> {
fn from(v: disk_v2::Writer<T, ProductionFilesystem>) -> Self {
impl<T: Bufferable> From<disk_v2::BufferWriter<T, ProductionFilesystem>> for SenderAdapter<T> {
fn from(v: disk_v2::BufferWriter<T, ProductionFilesystem>) -> Self {
Self::DiskV2(Arc::new(Mutex::new(v)))
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-buffers/src/variants/disk_v2/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ mod tests {
};

#[test]
#[should_panic]
#[should_panic(expected = "`amount` must be less than `MAX_ALIGNABLE_AMOUNT`")]
fn test_align16_too_large() {
// We forcefully panic if the input to `align16` is too large to align without overflow, primarily because
// that's a huge amount even on 32-bit systems and in non-test code, we only use `align16` in a const context,
Expand Down
Loading

0 comments on commit bfa6e52

Please sign in to comment.