-
Notifications
You must be signed in to change notification settings - Fork 89
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
workflow: add clippy and cargo-deny linters #22
Conversation
adds a GitHub workflow that performs clippy linting and cargo-deny auditing on Rust code. Fixes kuasar-io#12
4824971
to
cbd55e0
Compare
Clippy error fixed. |
@@ -205,7 +205,7 @@ impl KuasarFactory { | |||
// pivot_root could not work with initramfs | |||
match get_mount_type("/") { | |||
Ok(m_type) => { | |||
if m_type == "rootfs".to_string() { | |||
if m_type == *"rootfs" { |
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.
Why '*' is needed?
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.
- Efficiency: the second approach is more efficient. Dereferencing string literal to &str types requires no additional memory allocation or replication.
- Code brevity: the second approach is more concise, with no unnecessary method calls and type conversions.
.vhost(false) | ||
.vhostfds(vec![]) | ||
.bus(Some(DEFAULT_PCIE_BUS.to_string())) | ||
.build(); |
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.
the benefits of new one is reducing input params or else?
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.
Yes, clippy recommends not having too many parameters.
So I try to reduce the argument of the function.
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.
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.
OK
Signed-off-by: dierbei <1628652790@qq.com>
/lgtm |
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.
LGTM. Thank you.
adds a GitHub workflow that performs clippy linting and cargo-deny auditing on Rust code.
Fixes #12