Skip to content

fix: more rustic way of option chaining in constructor?

Sign in for the full log view
GitHub Actions / clippy failed Mar 5, 2024 in 0s

clippy

1 error, 1 warning

Details

Results

Message level Amount
Internal compiler error 0
Error 1
Warning 1
Note 0
Help 0

Versions

  • rustc 1.76.0 (07dca489a 2024-02-04)
  • cargo 1.76.0 (c84b36747 2024-01-18)
  • clippy 0.1.76 (07dca48 2024-02-04)

Annotations

Check warning on line 183 in libraries/common-arm/src/sd_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `size`

warning: unused variable: `size`
   --> libraries/common-arm/src/sd_manager.rs:183:16
    |
183 |             Ok(size) => true,
    |                ^^^^ help: if this is intentional, prefix it with an underscore: `_size`
    |
    = note: `#[warn(unused_variables)]` on by default

Check failure on line 174 in libraries/common-arm/src/sd_manager.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

cannot move out of `self.root_directory` which is behind a mutable reference

error[E0507]: cannot move out of `self.root_directory` which is behind a mutable reference
   --> libraries/common-arm/src/sd_manager.rs:174:13
    |
174 |             self.root_directory.unwrap()
    |             ^^^^^^^^^^^^^^^^^^^ -------- `self.root_directory` moved due to this method call
    |             |
    |             help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
    |             move occurs because `self.root_directory` has type `core::option::Option<embedded_sdmmc::Directory>`, which does not implement the `Copy` trait
    |
note: `core::option::Option::<T>::unwrap` takes ownership of the receiver `self`, which moves `self.root_directory`
   --> /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/option.rs:928:25
help: you could `clone` the value and consume it, if the `embedded_sdmmc::Directory: core::clone::Clone` trait bound could be satisfied
    |
174 |             <core::option::Option<embedded_sdmmc::Directory> as Clone>::clone(&self.root_directory).unwrap()
    |             +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                   +