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

Fix nightly clippy warnings #152

Merged
merged 4 commits into from
Nov 20, 2023
Merged

Fix nightly clippy warnings #152

merged 4 commits into from
Nov 20, 2023

Conversation

00xc
Copy link
Member

@00xc 00xc commented Nov 8, 2023

Fix warnings that appear on the nightly version of clippy. These simply improve code clarity, there is no functional change.

00xc added 4 commits November 8, 2023 11:18
Fix the following warning that will appear on a future (e.g. nightly)
version of clippy:

warning: use of a fallible conversion when an infallible one could be used
   --> src/svsm.rs:332:46
    |
332 |         launch_info.kernel_region_phys_start.try_into().unwrap(),
    |                                              ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
    = note: `#[warn(clippy::unnecessary_fallible_conversions)]` on by default

warning: use of a fallible conversion when an infallible one could be used
   --> src/svsm.rs:333:44
    |
333 |         launch_info.kernel_region_phys_end.try_into().unwrap(),
    |                                            ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions

Signed-off-by: Carlos López <[email protected]>
Fix several warnings like the following that will appear on a future
(e.g. nightly) version of clippy:

warning: use of a fallible conversion when an infallible one could be used
   --> src/elf/mod.rs:621:25
    |
621 |         let shdr_size = usize::try_from(elf_hdr.e_shentsize).unwrap();
    |                         ^^^^^^^^^^^^^^^ help: use: `From::from`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions

Signed-off-by: Carlos López <[email protected]>
Fix the followiing warnings like that will appear on a future
(e.g. nightly) version of clippy:

warning: use of a fallible conversion when an infallible one could be used
   --> src/cpu/percpu.rs:426:48
    |
426 |         vmsa_ref.rsp = self.get_top_of_stack().try_into().unwrap();
    |                                                ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions
    = note: `#[warn(clippy::unnecessary_fallible_conversions)]` on by default

warning: use of a fallible conversion when an infallible one could be used
   --> src/cpu/percpu.rs:427:55
    |
427 |         vmsa_ref.cr3 = self.get_pgtable().cr3_value().try_into().unwrap();
    |                                                       ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions

Signed-off-by: Carlos López <[email protected]>
Rename the Page enum to PageInfo, and remove the "Page" suffix of
variants' names that have it to improve readability. This also fixes
the following warnings that will appear on a future (e.g. nightly)
version of clippy:

warning: variant name ends with the enum's name
   --> src/mm/alloc.rs:197:5
    |
197 |     SlabPage(SlabPageInfo),
    |     ^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names
    = note: `#[warn(clippy::enum_variant_names)]` on by default

warning: variant name ends with the enum's name
   --> src/mm/alloc.rs:198:5
    |
198 |     CompoundPage(CompoundInfo),
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

warning: variant name ends with the enum's name
   --> src/mm/alloc.rs:199:5
    |
199 |     FilePage(FileInfo),
    |     ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names

Signed-off-by: Carlos López <[email protected]>
@joergroedel joergroedel merged commit 3d7c9f7 into coconut-svsm:main Nov 20, 2023
2 checks passed
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.

2 participants