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

Clippy Lints #37

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Clippy Lints #37

wants to merge 3 commits into from

Conversation

cholcombe973
Copy link
Contributor

@cholcombe973 cholcombe973 commented Jan 9, 2019

Warning! Many breaking changes here from clippy suggestions about best practices.

Copy link
Collaborator

@ChrisMacNaughton ChrisMacNaughton left a comment

Choose a reason for hiding this comment

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

While I'm generally happy with passing pointers instead of moving values, I'd like to understand the reasoning for these type changes, as well as the additional changes of pointer -> move

@@ -1099,7 +1110,7 @@ impl IoCtx {
}

/// Update tmap (trivial map)
pub fn rados_object_tmap_update(&self, object_name: &str, update: TmapOperation) -> RadosResult<()> {
pub fn rados_object_tmap_update(&self, object_name: &str, update: &TmapOperation) -> RadosResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to change from pass by value to a pointer?

@@ -1292,7 +1303,7 @@ impl IoCtx {
}

// Perform a compound read operation synchronously
pub fn rados_perform_read_operations(&self, read_op: ReadOperation) -> RadosResult<()> {
pub fn rados_perform_read_operations(&self, read_op: &ReadOperation) -> RadosResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to change from pass by value to a pointer?

@@ -1937,7 +1939,7 @@ impl Rados {
name: &str,
value: &str,
format: Option<&str>,
data: Vec<*mut c_char>,
data: &[*mut c_char],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to change from pass by value to a pointer?

@@ -2025,7 +2027,7 @@ impl Rados {
name: &str,
value: &str,
format: Option<&str>,
data: Vec<*mut c_char>,
data: &[*mut c_char],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to change from pass by value to a pointer?

@@ -2112,7 +2114,7 @@ impl Rados {
name: &str,
value: &str,
format: Option<&str>,
data: Vec<*mut c_char>,
data: &[*mut c_char],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to change from pass by value to a pointer?

@@ -279,7 +287,7 @@ impl CephClient {
Ok(cmd::mgr_versions(&self.rados_t)?)
}

pub fn run_command(&self, command: MonCommand) -> Result<String, RadosError> {
pub fn run_command(&self, command: &MonCommand) -> Result<String, RadosError> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to change from pass by value to a pointer?

@@ -590,7 +659,7 @@ pub fn osd_crush_remove(cluster_handle: &Rados, osd_id: u64, simulate: bool) ->
}

/// Query a ceph pool.
pub fn osd_pool_get(cluster_handle: &Rados, pool: &str, choice: &PoolOption) -> RadosResult<String> {
pub fn osd_pool_get(cluster_handle: &Rados, pool: &str, choice: PoolOption) -> RadosResult<String> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unlike the (many) comments about moves vs pointers, the ones in this file are the reverse?

Also fix some double pointers and use rados_buffer_free for
ceph heap allocated memory. Prevent mem leaks
@cholcombe973
Copy link
Contributor Author

Yeah all of these changes are clippy suggestions that values weren't consumed by a function so they should be passed by reference or that enum's passed by reference would be more efficient if they were copied. I don't know how true the copy efficiency is because i haven't benchmarked it.

@Xuanwo Xuanwo force-pushed the master branch 2 times, most recently from ead7751 to 9b39b74 Compare September 3, 2024 13:14
@Xuanwo
Copy link
Collaborator

Xuanwo commented Sep 3, 2024

Hi, @cholcombe973, would you be interested in working on this again?

@cholcombe973
Copy link
Contributor Author

cholcombe973 commented Sep 3, 2024 via email

@Xuanwo
Copy link
Collaborator

Xuanwo commented Sep 3, 2024

Yeah I could try a rebase and clippy again to see what happens.

Perfect, thank you so much! I'm so happy you're still here, in this community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants