Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Update Rust toolchain to 1.83.0 #22068

Merged
merged 16 commits into from
Jan 3, 2025
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.82.0'},
build_args={'RUST_VERSION': '1.83.0'},
dockerfile='tilt/Dockerfile'
)

Expand Down
1 change: 0 additions & 1 deletion lib/codecs/src/decoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ pub enum DeserializerConfig {
///
/// Going forward, Vector will use that [Go SDK][implementation] as the reference implementation, which means
/// the codec may continue to relax the enforcement of specification.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should this be ///?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't think so. We want this to be a doc comment so that is extracted and rendered in the docs.

///
/// [gelf]: https://docs.graylog.org/docs/gelf
/// [implementation]: https://github.com/Graylog2/go-gelf/blob/v2/gelf/reader.go
Expand Down
2 changes: 1 addition & 1 deletion lib/codecs/src/encoding/format/gelf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use vector_core::{
/// of vector will still work.
/// The exception is that if 'Additional fields' are found to be missing an underscore prefix and
/// are otherwise valid field names, we prepend the underscore.

///
/// Errors that can occur during GELF serialization.
#[derive(Debug, Snafu)]
pub enum GelfSerializerError {
Expand Down
2 changes: 1 addition & 1 deletion lib/prometheus-parser/src/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl From<nom::Err<ErrorKind>> for ErrorKind {
}
}

impl<'a> nom::error::ParseError<&'a str> for ErrorKind {
impl nom::error::ParseError<&str> for ErrorKind {
fn from_error_kind(input: &str, kind: nom::error::ErrorKind) -> Self {
ErrorKind::Nom {
input: input.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion lib/tracing-limit/benches/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where

struct Visitor<'a>(MutexGuard<'a, String>);

impl<'a> field::Visit for Visitor<'a> {
impl field::Visit for Visitor<'_> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ nice readability improvement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I forgot to leave some comments about the clippy changes, but this was one of them about it being unnecessary to specify lifetimes in some places.

fn record_debug(&mut self, _field: &field::Field, value: &dyn fmt::Debug) {
use std::fmt::Write;
_ = write!(&mut *self.0, "{:?}", value);
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-buffers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ where
}
}

impl<'a, T> EventCount for &'a T
impl<T> EventCount for &T
where
T: EventCount,
{
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 @@ -64,7 +64,7 @@ pub(crate) const fn align16(amount: usize) -> usize {
"`amount` must be less than `MAX_ALIGNABLE_AMOUNT`"
);

((amount + SERIALIZER_ALIGNMENT - 1) / SERIALIZER_ALIGNMENT) * SERIALIZER_ALIGNMENT
amount.div_ceil(SERIALIZER_ALIGNMENT) * SERIALIZER_ALIGNMENT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note (no action need): interesting change, should be covered by existing tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, yeah, I didn't even notice this one since clippy --fix did it.

}

/// Gets the maximum possible data file size given the type-level numerical limits and buffer invariants.
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-buffers/src/variants/disk_v2/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl<'a> Record<'a> {
}
}

impl<'a> ArchivedRecord<'a> {
impl ArchivedRecord<'_> {
/// Gets the metadata of this record.
pub fn metadata(&self) -> u32 {
self.metadata
Expand Down
28 changes: 14 additions & 14 deletions lib/vector-buffers/src/variants/disk_v2/tests/known_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ use crate::{
EventCount,
};

impl AsMetadata for u32 {
fn into_u32(self) -> u32 {
self
}

fn from_u32(value: u32) -> Option<Self> {
if value < 32 {
Some(value)
} else {
None
}
}
}

#[tokio::test]
async fn reader_throws_error_when_record_length_delimiter_is_zero() {
with_temp_dir(|dir| {
Expand Down Expand Up @@ -686,20 +700,6 @@ async fn reader_throws_error_when_record_is_undecodable_via_metadata() {
static GET_METADATA_VALUE: AtomicU32 = AtomicU32::new(0);
static CAN_DECODE_VALUE: AtomicU32 = AtomicU32::new(0);

impl AsMetadata for u32 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippy complained that the impl would be pulled up so better to define it outside.

fn into_u32(self) -> u32 {
self
}

fn from_u32(value: u32) -> Option<Self> {
if value < 32 {
Some(value)
} else {
None
}
}
}

#[derive(Debug)]
struct ControllableRecord(u8);

Expand Down
4 changes: 2 additions & 2 deletions lib/vector-common/src/byte_size_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub trait ByteSizeOf {
fn allocated_bytes(&self) -> usize;
}

impl<'a, T> ByteSizeOf for &'a T
impl<T> ByteSizeOf for &T
where
T: ByteSizeOf,
{
Expand Down Expand Up @@ -64,7 +64,7 @@ impl ByteSizeOf for KeyString {
}
}

impl<'a> ByteSizeOf for &'a str {
impl ByteSizeOf for &str {
fn allocated_bytes(&self) -> usize {
0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct ComponentEventsDropped<'a, const INTENTIONAL: bool> {
pub reason: &'a str,
}

impl<'a, const INTENTIONAL: bool> InternalEvent for ComponentEventsDropped<'a, INTENTIONAL> {
impl<const INTENTIONAL: bool> InternalEvent for ComponentEventsDropped<'_, INTENTIONAL> {
fn emit(self) {
let count = self.count;
self.register().emit(Count(count));
Expand Down Expand Up @@ -48,7 +48,7 @@ pub struct DroppedHandle<'a, const INTENDED: bool> {
reason: &'a str,
}

impl<'a, const INTENDED: bool> InternalEventHandle for DroppedHandle<'a, INTENDED> {
impl<const INTENDED: bool> InternalEventHandle for DroppedHandle<'_, INTENDED> {
type Data = Count;
fn emit(&self, data: Self::Data) {
let message = "Events dropped";
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-config-macros/src/ast/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl<'a> Field<'a> {
}
}

impl<'a> ToTokens for Field<'a> {
impl ToTokens for Field<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
self.original.to_tokens(tokens)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/vector-config-macros/src/ast/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl<'a> Variant<'a> {
}
}

impl<'a> ToTokens for Variant<'a> {
impl ToTokens for Variant<'_> {
fn to_tokens(&self, tokens: &mut TokenStream) {
self.original.to_tokens(tokens)
}
Expand Down Expand Up @@ -204,7 +204,7 @@ impl Attributes {
}
}

impl<'a> PartialEq for Variant<'a> {
impl PartialEq for Variant<'_> {
fn eq(&self, other: &Self) -> bool {
// Equality checking between variants is only used to drive conformance checks around making
// sure no duplicate variants exist when in untagged mode, so all we care about is what
Expand Down
4 changes: 2 additions & 2 deletions lib/vector-config-macros/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl PartialEq<AttributeIdent> for Ident {
}
}

impl<'a> PartialEq<AttributeIdent> for &'a Ident {
impl PartialEq<AttributeIdent> for &Ident {
fn eq(&self, word: &AttributeIdent) -> bool {
*self == word.0
}
Expand All @@ -37,7 +37,7 @@ impl PartialEq<AttributeIdent> for Path {
}
}

impl<'a> PartialEq<AttributeIdent> for &'a Path {
impl PartialEq<AttributeIdent> for &Path {
fn eq(&self, word: &AttributeIdent) -> bool {
self.is_ident(word.0)
}
Expand Down
4 changes: 2 additions & 2 deletions lib/vector-config/src/schema/parser/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct ComponentSchema<'a> {
component_type: ComponentType,
}

impl<'a> ComponentSchema<'a> {
impl ComponentSchema<'_> {
/// The type of the component represented by this schema.
pub fn component_type(&self) -> ComponentType {
self.component_type
Expand All @@ -60,7 +60,7 @@ impl<'a> ComponentSchema<'a> {
}
}

impl<'a> QueryableSchema for ComponentSchema<'a> {
impl QueryableSchema for ComponentSchema<'_> {
fn schema_type(&self) -> SchemaType {
self.schema.schema_type()
}
Expand Down
6 changes: 3 additions & 3 deletions lib/vector-config/src/schema/parser/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub trait QueryableSchema {
fn has_flag_attribute(&self, key: &str) -> Result<bool, QueryError>;
}

impl<'a, T> QueryableSchema for &'a T
impl<T> QueryableSchema for &T
where
T: QueryableSchema,
{
Expand Down Expand Up @@ -265,7 +265,7 @@ where
}
}

impl<'a> QueryableSchema for &'a SchemaObject {
impl QueryableSchema for &SchemaObject {
fn schema_type(&self) -> SchemaType {
// TODO: Technically speaking, it is allowed to use the "X of" schema types in conjunction
// with other schema types i.e. `allOf` in conjunction with specifying a `type`.
Expand Down Expand Up @@ -387,7 +387,7 @@ impl<'a> From<&'a SchemaObject> for SimpleSchema<'a> {
}
}

impl<'a> QueryableSchema for SimpleSchema<'a> {
impl QueryableSchema for SimpleSchema<'_> {
fn schema_type(&self) -> SchemaType {
self.schema.schema_type()
}
Expand Down
19 changes: 11 additions & 8 deletions lib/vector-core/src/config/global_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,34 +165,37 @@ impl GlobalOptions {
pub fn merge(&self, with: Self) -> Result<Self, Vec<String>> {
let mut errors = Vec::new();

if conflicts(&self.proxy.http, &with.proxy.http) {
if conflicts(self.proxy.http.as_ref(), with.proxy.http.as_ref()) {
errors.push("conflicting values for 'proxy.http' found".to_owned());
}

if conflicts(&self.proxy.https, &with.proxy.https) {
if conflicts(self.proxy.https.as_ref(), with.proxy.https.as_ref()) {
errors.push("conflicting values for 'proxy.https' found".to_owned());
}

if !self.proxy.no_proxy.is_empty() && !with.proxy.no_proxy.is_empty() {
errors.push("conflicting values for 'proxy.no_proxy' found".to_owned());
}

if conflicts(&self.timezone, &with.timezone) {
if conflicts(self.timezone.as_ref(), with.timezone.as_ref()) {
errors.push("conflicting values for 'timezone' found".to_owned());
}

if conflicts(
&self.acknowledgements.enabled,
&with.acknowledgements.enabled,
self.acknowledgements.enabled.as_ref(),
with.acknowledgements.enabled.as_ref(),
) {
errors.push("conflicting values for 'acknowledgements' found".to_owned());
}

if conflicts(&self.expire_metrics, &with.expire_metrics) {
if conflicts(self.expire_metrics.as_ref(), with.expire_metrics.as_ref()) {
errors.push("conflicting values for 'expire_metrics' found".to_owned());
}

if conflicts(&self.expire_metrics_secs, &with.expire_metrics_secs) {
if conflicts(
self.expire_metrics_secs.as_ref(),
with.expire_metrics_secs.as_ref(),
) {
errors.push("conflicting values for 'expire_metrics_secs' found".to_owned());
}

Expand Down Expand Up @@ -239,7 +242,7 @@ impl GlobalOptions {
}
}

fn conflicts<T: PartialEq>(this: &Option<T>, that: &Option<T>) -> bool {
fn conflicts<T: PartialEq>(this: Option<&T>, that: Option<&T>) -> bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ nice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. This is the clippy lint that required the most changes, but was mechanical: rather than a reference to an option use an option with a reference.

matches!((this, that), (Some(this), Some(that)) if this != that)
}

Expand Down
6 changes: 3 additions & 3 deletions lib/vector-core/src/config/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl ProxyConfig {
fn build_proxy(
&self,
proxy_scheme: &'static str,
proxy_url: &Option<String>,
proxy_url: Option<&String>,
) -> Result<Option<Proxy>, InvalidUri> {
proxy_url
.as_ref()
Expand All @@ -180,11 +180,11 @@ impl ProxyConfig {
}

fn http_proxy(&self) -> Result<Option<Proxy>, InvalidUri> {
self.build_proxy("http", &self.http)
self.build_proxy("http", self.http.as_ref())
}

fn https_proxy(&self) -> Result<Option<Proxy>, InvalidUri> {
self.build_proxy("https", &self.https)
self.build_proxy("https", self.https.as_ref())
}

/// Install the [`ProxyConnector<C>`] for this `ProxyConfig`
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-core/src/event/metric/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ where
{
struct UpperLimitVisitor;

impl<'de> de::Visitor<'de> for UpperLimitVisitor {
impl de::Visitor<'_> for UpperLimitVisitor {
type Value = f64;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-core/src/event/ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<'a> From<&'a TraceEvent> for EventRef<'a> {
}
}

impl<'a> EventDataEq<Event> for EventRef<'a> {
impl EventDataEq<Event> for EventRef<'_> {
fn event_data_eq(&self, that: &Event) -> bool {
match (self, that) {
(Self::Log(a), Event::Log(b)) => a.event_data_eq(b),
Expand Down
2 changes: 1 addition & 1 deletion lib/vector-core/src/event/util/log/all_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<'a> Iterator for FieldsIter<'a> {
}
}

impl<'a> Serialize for FieldsIter<'a> {
impl Serialize for FieldsIter<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down
6 changes: 3 additions & 3 deletions lib/vector-core/src/fanout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,15 +905,15 @@ mod tests {
}
}

fn _make_events(count: usize) -> impl Iterator<Item = LogEvent> {
fn make_events_inner(count: usize) -> impl Iterator<Item = LogEvent> {
(0..count).map(|i| LogEvent::from(format!("line {i}")))
}

fn make_events(count: usize) -> Vec<Event> {
_make_events(count).map(Into::into).collect()
make_events_inner(count).map(Into::into).collect()
}

fn make_event_array(count: usize) -> EventArray {
_make_events(count).collect::<Vec<_>>().into()
make_events_inner(count).collect::<Vec<_>>().into()
}
}
Loading
Loading