Skip to content

Commit

Permalink
style: apply new Clippy lints from upgrading Rust
Browse files Browse the repository at this point in the history
Signed-off-by: Fletcher Nichol <[email protected]>
  • Loading branch information
fnichol committed Jan 3, 2025
1 parent d4f9207 commit 8d4b5cb
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 87 deletions.
20 changes: 10 additions & 10 deletions lib/config-file/src/layered_load/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl Serializer {
}
}

impl<'a> ser::Serializer for &'a mut Serializer {
impl ser::Serializer for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand Down Expand Up @@ -258,7 +258,7 @@ impl<'a> ser::Serializer for &'a mut Serializer {
}
}

impl<'a> ser::SerializeSeq for &'a mut Serializer {
impl ser::SerializeSeq for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand All @@ -279,7 +279,7 @@ impl<'a> ser::SerializeSeq for &'a mut Serializer {
}
}

impl<'a> ser::SerializeTuple for &'a mut Serializer {
impl ser::SerializeTuple for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand All @@ -292,7 +292,7 @@ impl<'a> ser::SerializeTuple for &'a mut Serializer {
}
}

impl<'a> ser::SerializeTupleStruct for &'a mut Serializer {
impl ser::SerializeTupleStruct for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand All @@ -305,7 +305,7 @@ impl<'a> ser::SerializeTupleStruct for &'a mut Serializer {
}
}

impl<'a> ser::SerializeTupleVariant for &'a mut Serializer {
impl ser::SerializeTupleVariant for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand All @@ -318,7 +318,7 @@ impl<'a> ser::SerializeTupleVariant for &'a mut Serializer {
}
}

impl<'a> ser::SerializeMap for &'a mut Serializer {
impl ser::SerializeMap for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand All @@ -343,7 +343,7 @@ impl<'a> ser::SerializeMap for &'a mut Serializer {
}
}

impl<'a> ser::SerializeStruct for &'a mut Serializer {
impl ser::SerializeStruct for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand Down Expand Up @@ -371,7 +371,7 @@ impl<'a> ser::SerializeStruct for &'a mut Serializer {
}
}

impl<'a> ser::SerializeStructVariant for &'a mut Serializer {
impl ser::SerializeStructVariant for &mut Serializer {
type Ok = ();
type Error = SerializerError;

Expand All @@ -396,7 +396,7 @@ struct MapKeySerializer<'a> {
ser: &'a mut Serializer,
}

impl<'a> MapKeySerializer<'a> {
impl MapKeySerializer<'_> {
fn push_key(&mut self, key: &str) {
if !self.ser.key.is_empty() {
self.ser.key.push('.');
Expand All @@ -405,7 +405,7 @@ impl<'a> MapKeySerializer<'a> {
}
}

impl<'a> ser::Serializer for MapKeySerializer<'a> {
impl ser::Serializer for MapKeySerializer<'_> {
type Ok = ();
type Error = SerializerError;

Expand Down
4 changes: 2 additions & 2 deletions lib/dal-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl fmt::Debug for DalContextHead {
/// To use mutably borrowed `DalContext` version, use [`DalContextHeadMutRef`].
pub struct DalContextHeadRef<'a>(pub &'a DalContext);

impl<'a> fmt::Debug for DalContextHeadRef<'a> {
impl fmt::Debug for DalContextHeadRef<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("DalContextHeadRef").finish_non_exhaustive()
}
Expand All @@ -145,7 +145,7 @@ impl<'a> fmt::Debug for DalContextHeadRef<'a> {
/// To use a borrowed `DalContext` version, use [`DalContextHeadRef`].
pub struct DalContextHeadMutRef<'a>(pub &'a mut DalContext);

impl<'a> fmt::Debug for DalContextHeadMutRef<'a> {
impl fmt::Debug for DalContextHeadMutRef<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("DalContextHeadMutRef")
.finish_non_exhaustive()
Expand Down
4 changes: 2 additions & 2 deletions lib/dal/src/change_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl ChangeSet {
if let Some(merge_requested_by) = self.merge_requested_by_user_id {
User::get_by_pk(ctx, merge_requested_by).await?.map(|user| {
if user.name().is_empty() {
return user.email().clone();
user.email().clone()
} else {
user.name().clone()
}
Expand All @@ -278,7 +278,7 @@ impl ChangeSet {
let reviewed_by_user = if let Some(reviewed_by) = self.reviewed_by_user_id {
User::get_by_pk(ctx, reviewed_by).await?.map(|user| {
if user.name().is_empty() {
return user.email().clone();
user.email().clone()
} else {
user.name().clone()
}
Expand Down
1 change: 0 additions & 1 deletion lib/dal/src/secret/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub enum SecretViewError {
}

#[allow(missing_docs)]

pub type SecretViewResult<T> = Result<T, SecretViewError>;

/// A [`view`](SecretView) of a corresponding [`Secret`].
Expand Down
12 changes: 6 additions & 6 deletions lib/dal/src/workspace_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ struct SnapshotWriteGuard<'a> {
working_copy_write_guard: RwLockWriteGuard<'a, Option<WorkspaceSnapshotGraphVCurrent>>,
}

impl<'a> std::ops::Deref for SnapshotReadGuard<'a> {
impl std::ops::Deref for SnapshotReadGuard<'_> {
type Target = WorkspaceSnapshotGraphVCurrent;

fn deref(&self) -> &Self::Target {
Expand All @@ -277,7 +277,7 @@ impl<'a> std::ops::Deref for SnapshotReadGuard<'a> {
}
}

impl<'a> std::ops::Deref for SnapshotWriteGuard<'a> {
impl std::ops::Deref for SnapshotWriteGuard<'_> {
type Target = WorkspaceSnapshotGraphVCurrent;

fn deref(&self) -> &Self::Target {
Expand All @@ -288,7 +288,7 @@ impl<'a> std::ops::Deref for SnapshotWriteGuard<'a> {
}
}

impl<'a> std::ops::DerefMut for SnapshotWriteGuard<'a> {
impl std::ops::DerefMut for SnapshotWriteGuard<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
let option: &mut Option<WorkspaceSnapshotGraphVCurrent> =
&mut self.working_copy_write_guard;
Expand All @@ -306,7 +306,7 @@ pub struct InferredConnectionsWriteGuard<'a> {
inferred_connection_graph: RwLockWriteGuard<'a, Option<InferredConnectionGraph>>,
}

impl<'a> std::ops::Deref for InferredConnectionsReadGuard<'a> {
impl std::ops::Deref for InferredConnectionsReadGuard<'_> {
type Target = InferredConnectionGraph;

fn deref(&self) -> &Self::Target {
Expand All @@ -317,7 +317,7 @@ impl<'a> std::ops::Deref for InferredConnectionsReadGuard<'a> {
}
}

impl<'a> std::ops::Deref for InferredConnectionsWriteGuard<'a> {
impl std::ops::Deref for InferredConnectionsWriteGuard<'_> {
type Target = InferredConnectionGraph;

fn deref(&self) -> &Self::Target {
Expand All @@ -328,7 +328,7 @@ impl<'a> std::ops::Deref for InferredConnectionsWriteGuard<'a> {
}
}

impl<'a> std::ops::DerefMut for InferredConnectionsWriteGuard<'a> {
impl std::ops::DerefMut for InferredConnectionsWriteGuard<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
let maybe: &mut Option<InferredConnectionGraph> = &mut self.inferred_connection_graph;
&mut *maybe
Expand Down
4 changes: 2 additions & 2 deletions lib/naxum-api-types/src/content_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct ContentInfo<'a> {
pub message_version: MessageVersion,
}

impl<'a> ContentInfo<'a> {
impl ContentInfo<'_> {
/// Injects the content information into NATS message headers.
pub fn inject_into_headers(&self, headers: &mut HeaderMap) {
headers.insert(NATS_HEADER_CONTENT_TYPE_NAME, self.content_type.as_str());
Expand Down Expand Up @@ -89,7 +89,7 @@ where
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ContentType<'a>(Cow<'a, str>);

impl<'a> ContentType<'a> {
impl ContentType<'_> {
/// Returns the interior data as a borrowed string.
pub fn as_str(&self) -> &str {
self.0.as_ref()
Expand Down
2 changes: 1 addition & 1 deletion lib/object-tree/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl<'a, T> NodeWithEntriesRef<'a, T> {
}
}

impl<'a, T> WriteBytes for NodeWithEntriesRef<'a, T>
impl<T> WriteBytes for NodeWithEntriesRef<'_, T>
where
T: WriteBytes,
{
Expand Down
1 change: 0 additions & 1 deletion lib/sdf-server/src/service/diagram/delete_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use si_events::audit_log::AuditLogKind;

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]

pub struct DeleteConnectionRequest {
pub from_socket_id: OutputSocketId,
pub from_component_id: ComponentId,
Expand Down
5 changes: 2 additions & 3 deletions lib/sdf-server/src/service/v2/func/get_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ use crate::extract::{AccessBuilder, HandlerContext, PosthogClient};

use super::{get_code_response, FuncAPIResult};

#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]

// TODO: find the right way to pass a Vec<FuncId>
// the API call uses the `id[]=<...>&id[]=<...?` format
// but that doesn't work here with Rust
#[derive(Deserialize, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct GetRequest {
pub id: FuncId,
}
Expand Down
6 changes: 3 additions & 3 deletions lib/si-data-pg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2068,15 +2068,15 @@ impl<'a> InstrumentedTransaction<'a> {
net.transport = %self.metadata.net_transport,
)
)]
pub fn client(&'a self) -> &Client {
pub fn client(&'a self) -> &'a Client {
let span = current_span_for_instrument_at!("debug");

span.follows_from(&self.tx_span);
self.tx_span.in_scope(|| self.inner.client())
}
}

impl<'a> fmt::Debug for InstrumentedTransaction<'a> {
impl fmt::Debug for InstrumentedTransaction<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("InstrumentedTransaction")
.field("metadata", &self.metadata)
Expand Down Expand Up @@ -2201,7 +2201,7 @@ impl<'a> InstrumentedTransactionBuilder<'a> {
}
}

impl<'a> fmt::Debug for InstrumentedTransactionBuilder<'a> {
impl fmt::Debug for InstrumentedTransactionBuilder<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("InstrumentedTransactionBuilder")
.field("metadata", &self.metadata)
Expand Down
2 changes: 1 addition & 1 deletion lib/si-events-rs/src/rebase_batch_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Serialize for RebaseBatchAddress {

struct RebaseBatchAddressVisitor;

impl<'de> Visitor<'de> for RebaseBatchAddressVisitor {
impl Visitor<'_> for RebaseBatchAddressVisitor {
type Value = RebaseBatchAddress;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion lib/si-events-rs/src/vector_clock_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct VectorClockId {

pub struct VectorClockIdStringDeserializeVisitor;

impl<'de> serde::de::Visitor<'de> for VectorClockIdStringDeserializeVisitor {
impl serde::de::Visitor<'_> for VectorClockIdStringDeserializeVisitor {
type Value = VectorClockId;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion lib/si-events-rs/src/workspace_snapshot_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Serialize for WorkspaceSnapshotAddress {

struct WorkspaceSnapshotAddressVisitor;

impl<'de> Visitor<'de> for WorkspaceSnapshotAddressVisitor {
impl Visitor<'_> for WorkspaceSnapshotAddressVisitor {
type Value = WorkspaceSnapshotAddress;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion lib/si-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Serialize for Hash {

struct HashVisitor;

impl<'de> Visitor<'de> for HashVisitor {
impl Visitor<'_> for HashVisitor {
type Value = Hash;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion lib/si-id/src/ulid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Ulid {

struct UlidVisitor;

impl<'de> ::serde::de::Visitor<'de> for UlidVisitor {
impl ::serde::de::Visitor<'_> for UlidVisitor {
type Value = Ulid;

fn expecting(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion lib/si-pkg/src/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl<'a> Source<'a> {
}
}

impl<'a> fmt::Debug for Source<'a> {
impl fmt::Debug for Source<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Source")
.field("graph", &"...")
Expand Down
2 changes: 1 addition & 1 deletion lib/si-pkg/src/pkg/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<'a> SiPkgSchemaVariant<'a> {
source: Source<'a>,
node_idx: NodeIndex,
parent_info: Option<I>,
) -> PkgResult<Vec<(SiPkgProp, Option<I>)>>
) -> PkgResult<Vec<(SiPkgProp<'a>, Option<I>)>>
where
I: ToOwned + Clone,
{
Expand Down
Loading

0 comments on commit 8d4b5cb

Please sign in to comment.