This is an automated email from the ASF dual-hosted git repository.
hgruszecki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new bb97a3b3 chore(repo): fix clippy lints for Rust 1.87 (#1800)
bb97a3b3 is described below
commit bb97a3b3139d1daf414292fb13d7a8e46e7eefd6
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Sat May 17 14:02:44 2025 +0200
chore(repo): fix clippy lints for Rust 1.87 (#1800)
---
core/bench/src/plot.rs | 9 +++------
core/binary_protocol/src/cli/binary_context/common.rs | 5 ++---
core/integration/tests/streaming/segment.rs | 12 ++++--------
core/sdk/src/tcp/tcp_connection_stream_kind.rs | 1 +
core/server/src/archiver/mod.rs | 1 +
core/server/src/http/mapper.rs | 5 ++---
core/server/src/streaming/segments/indexes/indexes_mut.rs | 2 +-
.../src/streaming/segments/types/messages_batch_mut.rs | 2 +-
core/server/src/streaming/systems/streams.rs | 6 +++---
9 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/core/bench/src/plot.rs b/core/bench/src/plot.rs
index 2310132d..3d75be77 100644
--- a/core/bench/src/plot.rs
+++ b/core/bench/src/plot.rs
@@ -132,10 +132,7 @@ fn save_chart(
let full_output_path = Path::new(output_directory).join(format!("{}.html",
file_name));
let mut renderer = HtmlRenderer::new(file_name, width,
height).theme(Theme::Dark);
- renderer.save(chart, &full_output_path).map_err(|e| {
- std::io::Error::new(
- std::io::ErrorKind::Other,
- format!("Failed to save HTML plot: {}", e),
- )
- })
+ renderer
+ .save(chart, &full_output_path)
+ .map_err(|e| std::io::Error::other(format!("Failed to save HTML plot:
{}", e)))
}
diff --git a/core/binary_protocol/src/cli/binary_context/common.rs
b/core/binary_protocol/src/cli/binary_context/common.rs
index 9ba0ea03..1d96e5ae 100644
--- a/core/binary_protocol/src/cli/binary_context/common.rs
+++ b/core/binary_protocol/src/cli/binary_context/common.rs
@@ -276,9 +276,8 @@ impl Default for ContextReaderWriter {
}
pub fn iggy_home() -> Option<PathBuf> {
- let iggy_home = match var(ENV_IGGY_HOME) {
+ match var(ENV_IGGY_HOME) {
Ok(home) => Some(PathBuf::from(home)),
Err(_) => home_dir().map(|dir|
dir.join(path::Path::new(DEFAULT_IGGY_HOME_VALUE))),
- };
- iggy_home
+ }
}
diff --git a/core/integration/tests/streaming/segment.rs
b/core/integration/tests/streaming/segment.rs
index 42ce8158..6bd86ba6 100644
--- a/core/integration/tests/streaming/segment.rs
+++ b/core/integration/tests/streaming/segment.rs
@@ -673,11 +673,11 @@ async fn assert_persisted_segment(partition_path: &str,
start_offset: u64) {
}
fn get_segment_paths_for_partition(partition_path: &str) -> Vec<DirEntry> {
- let paths = std::fs::read_dir(partition_path)
+ std::fs::read_dir(partition_path)
.map(|read_dir| {
read_dir
.filter_map(|dir_entry| {
- let result = dir_entry
+ dir_entry
.map(|dir_entry| {
match dir_entry
.path()
@@ -689,15 +689,11 @@ fn get_segment_paths_for_partition(partition_path: &str)
-> Vec<DirEntry> {
}
})
.ok()
- .flatten();
-
- result
+ .flatten()
})
.collect::<Vec<_>>()
})
- .unwrap_or_default();
-
- paths
+ .unwrap_or_default()
}
fn get_start_offsets() -> Vec<u64> {
diff --git a/core/sdk/src/tcp/tcp_connection_stream_kind.rs
b/core/sdk/src/tcp/tcp_connection_stream_kind.rs
index 3f3049f5..20f6bedb 100644
--- a/core/sdk/src/tcp/tcp_connection_stream_kind.rs
+++ b/core/sdk/src/tcp/tcp_connection_stream_kind.rs
@@ -21,6 +21,7 @@ use
crate::tcp::tcp_tls_connection_stream::TcpTlsConnectionStream;
use iggy_common::IggyError;
#[derive(Debug)]
+#[allow(clippy::large_enum_variant)] // TODO(hubcio): consider `Box`ing
pub(crate) enum ConnectionStreamKind {
Tcp(TcpConnectionStream),
TcpTls(TcpTlsConnectionStream),
diff --git a/core/server/src/archiver/mod.rs b/core/server/src/archiver/mod.rs
index 983e733d..7b6aaa34 100644
--- a/core/server/src/archiver/mod.rs
+++ b/core/server/src/archiver/mod.rs
@@ -68,6 +68,7 @@ pub trait Archiver: Send {
}
#[derive(Debug)]
+#[allow(clippy::large_enum_variant)] // TODO(hubcio): consider `Box`ing
pub enum ArchiverKind {
Disk(DiskArchiver),
S3(S3Archiver),
diff --git a/core/server/src/http/mapper.rs b/core/server/src/http/mapper.rs
index 81aa0483..ed9ebba3 100644
--- a/core/server/src/http/mapper.rs
+++ b/core/server/src/http/mapper.rs
@@ -159,7 +159,7 @@ pub fn map_personal_access_tokens(
}
pub fn map_client(client: &Client) -> iggy_common::ClientInfoDetails {
- let client = iggy_common::ClientInfoDetails {
+ iggy_common::ClientInfoDetails {
client_id: client.session.client_id,
user_id: client.user_id,
transport: client.transport.to_string(),
@@ -174,8 +174,7 @@ pub fn map_client(client: &Client) ->
iggy_common::ClientInfoDetails {
group_id: consumer_group.group_id,
})
.collect(),
- };
- client
+ }
}
pub async fn map_clients(clients: &[IggySharedMut<Client>]) ->
Vec<iggy_common::ClientInfo> {
diff --git a/core/server/src/streaming/segments/indexes/indexes_mut.rs
b/core/server/src/streaming/segments/indexes/indexes_mut.rs
index 6a22b475..92fcab87 100644
--- a/core/server/src/streaming/segments/indexes/indexes_mut.rs
+++ b/core/server/src/streaming/segments/indexes/indexes_mut.rs
@@ -52,7 +52,7 @@ impl IggyIndexesMut {
/// Decompose the container into its components
pub fn decompose(mut self) -> (u32, PooledBuffer) {
let base_position = self.base_position;
- let buffer = std::mem::replace(&mut self.buffer,
PooledBuffer::empty());
+ let buffer = std::mem::take(&mut self.buffer);
(base_position, buffer)
}
diff --git a/core/server/src/streaming/segments/types/messages_batch_mut.rs
b/core/server/src/streaming/segments/types/messages_batch_mut.rs
index acf948f7..c6006470 100644
--- a/core/server/src/streaming/segments/types/messages_batch_mut.rs
+++ b/core/server/src/streaming/segments/types/messages_batch_mut.rs
@@ -259,7 +259,7 @@ impl IggyMessagesBatchMut {
/// Decomposes the batch into its constituent parts.
pub fn decompose(mut self) -> (IggyIndexesMut, PooledBuffer) {
let indexes = std::mem::replace(&mut self.indexes,
IggyIndexesMut::empty());
- let messages = std::mem::replace(&mut self.messages,
PooledBuffer::empty());
+ let messages = std::mem::take(&mut self.messages);
(indexes, messages)
}
diff --git a/core/server/src/streaming/systems/streams.rs
b/core/server/src/streaming/systems/streams.rs
index a22a8a83..18c6aa83 100644
--- a/core/server/src/streaming/systems/streams.rs
+++ b/core/server/src/streaming/systems/streams.rs
@@ -130,12 +130,12 @@ impl System {
let loaded_streams = RefCell::new(Vec::new());
let load_stream_tasks = unloaded_streams.into_iter().map(|mut stream| {
let state = streams_states.remove(&stream.stream_id).unwrap();
- let load_stream_task = async {
+
+ async {
stream.load(state).await?;
loaded_streams.borrow_mut().push(stream);
Result::<(), IggyError>::Ok(())
- };
- load_stream_task
+ }
});
try_join_all(load_stream_tasks).await?;