-
Notifications
You must be signed in to change notification settings - Fork 43
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
base: master
Are you sure you want to change the base?
Clippy Lints #37
Conversation
There was a problem hiding this 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<()> { |
There was a problem hiding this comment.
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<()> { |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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
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. |
ead7751
to
9b39b74
Compare
Hi, @cholcombe973, would you be interested in working on this again? |
Yeah I could try a rebase and clippy again to see what happens.
…On Tue, Sep 3, 2024 at 7:23 AM Xuanwo ***@***.***> wrote:
Hi, @cholcombe973 <https://github.com/cholcombe973>, would you be
interested in working on this again?
—
Reply to this email directly, view it on GitHub
<#37 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXKUE23AB4IUCB7HTSCEWLZUXA73AVCNFSM6AAAAABNSILQTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRWGY3DEMJYG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Perfect, thank you so much! I'm so happy you're still here, in this community. |
Warning! Many breaking changes here from clippy suggestions about best practices.