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

workflow: add clippy and cargo-deny linters #22

Merged
merged 2 commits into from
Jun 2, 2023

Conversation

dierbei
Copy link
Contributor

@dierbei dierbei commented May 25, 2023

adds a GitHub workflow that performs clippy linting and cargo-deny auditing on Rust code.

Fixes #12

adds a GitHub workflow that performs clippy linting and cargo-deny auditing on Rust code.

Fixes kuasar-io#12
@Burning1020 Burning1020 mentioned this pull request May 26, 2023
8 tasks
@dierbei dierbei force-pushed the lint branch 6 times, most recently from 4824971 to cbd55e0 Compare May 28, 2023 11:16
@dierbei
Copy link
Contributor Author

dierbei commented May 29, 2023

Clippy error fixed.

vmm/sandbox/src/main.rs Outdated Show resolved Hide resolved
vmm/sandbox/src/network/address.rs Outdated Show resolved Hide resolved
@@ -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" {
Copy link
Member

Choose a reason for hiding this comment

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

Why '*' is needed?

Copy link
Contributor Author

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.

vmm/sandbox/src/main.rs Outdated Show resolved Hide resolved
vmm/sandbox/src/main.rs Outdated Show resolved Hide resolved
vmm/sandbox/src/stratovirt/config.rs Outdated Show resolved Hide resolved
vmm/sandbox/src/stratovirt/devices/char.rs Outdated Show resolved Hide resolved
vmm/sandbox/src/utils.rs Show resolved Hide resolved
.vhost(false)
.vhostfds(vec![])
.bus(Some(DEFAULT_PCIE_BUS.to_string()))
.build();
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

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>
@Vanient
Copy link
Member

Vanient commented Jun 1, 2023

/lgtm

Copy link
Member

@Burning1020 Burning1020 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

@Burning1020 Burning1020 merged commit 9b18fb4 into kuasar-io:main Jun 2, 2023
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.

Umbrella issue for basic function
3 participants