Skip to content

Commit

Permalink
Fix Rust 1.83 clippy errors
Browse files Browse the repository at this point in the history
Fix 29 "needless_lifetimes" errors, and one error in a test, for
"implicit_saturating_sub", in strat_engine/tests/real.rs.

Signed-off-by: Bryan Gurney <[email protected]>
  • Loading branch information
bgurney-rh authored and mulkieran committed Dec 3, 2024
1 parent 2826cc4 commit 635e617
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/engine/sim_engine/blockdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl SimDev {
}
}

impl<'a> Into<Value> for &'a SimDev {
impl Into<Value> for &SimDev {
fn into(self) -> Value {
let mut json = Map::new();
json.insert(
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sim_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Default for SimEngine {
}
}

impl<'a> Into<Value> for &'a SimEngine {
impl Into<Value> for &SimEngine {
// Precondition: SimPool Into<Value> impl return value always pattern matches
// Value::Object(_)
fn into(self) -> Value {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sim_engine/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl Filesystem for SimFilesystem {
}
}

impl<'a> Into<Value> for &'a SimFilesystem {
impl Into<Value> for &SimFilesystem {
fn into(self) -> Value {
let mut json = Map::new();
json.insert("size".to_string(), Value::from(self.size().to_string()));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sim_engine/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl SimPool {

// Precondition: SimDev::into() always returns a value that matches Value::Object(_).
// Precondition: SimFilesystem::into() always returns a value that matches Value::Object(_).
impl<'a> Into<Value> for &'a SimPool {
impl Into<Value> for &SimPool {
fn into(self) -> Value {
json!({
"available_actions": ActionAvailability::Full.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/backstore/backstore/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ impl Backstore {
}
}

impl<'a> Into<Value> for &'a Backstore {
impl Into<Value> for &Backstore {
fn into(self) -> Value {
json!({
"blockdevs": {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/backstore/backstore/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ impl Backstore {
}
}

impl<'a> Into<Value> for &'a Backstore {
impl Into<Value> for &Backstore {
fn into(self) -> Value {
json!({
"blockdevs": {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/backstore/blockdev/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl InternalBlockDev for StratBlockDev {
}
}

impl<'a> Into<Value> for &'a StratBlockDev {
impl Into<Value> for &StratBlockDev {
fn into(self) -> Value {
let mut json = json!({
"path": self.underlying_device.physical_path(),
Expand Down Expand Up @@ -638,7 +638,7 @@ impl StateDiff for StratBlockDevState {
}
}

impl<'a> DumpState<'a> for StratBlockDev {
impl DumpState<'_> for StratBlockDev {
type State = StratBlockDevState;
type DumpInput = Sectors;

Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/backstore/blockdev/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ impl InternalBlockDev for StratBlockDev {
}
}

impl<'a> Into<Value> for &'a StratBlockDev {
impl Into<Value> for &StratBlockDev {
fn into(self) -> Value {
let mut json = json!({
"path": self.devnode(),
Expand Down Expand Up @@ -456,7 +456,7 @@ impl StateDiff for StratBlockDevState {
}
}

impl<'a> DumpState<'a> for StratBlockDev {
impl DumpState<'_> for StratBlockDev {
type State = StratBlockDevState;
type DumpInput = Sectors;

Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/backstore/range_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl<'a> Iterator for Iter<'a> {
}
}

impl<'a> DoubleEndedIterator for Iter<'a> {
impl DoubleEndedIterator for Iter<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.items.next_back()
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ impl StratEngine {
}
}

impl<'a> Into<Value> for &'a StratEngine {
impl Into<Value> for &StratEngine {
// Precondition: (&StratPool).into() pattern matches Value::Object(_)
// Precondition: (&LiminalDevices).into() pattern matches Value::Object(_)
fn into(self) -> Value {
Expand Down
10 changes: 5 additions & 5 deletions src/engine/strat_engine/liminal/device_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl From<LuksInfo> for LLuksInfo {
}
}

impl<'a> Into<Value> for &'a LLuksInfo {
impl Into<Value> for &LLuksInfo {
// Precondition: (&StratisInfo).into() pattern matches Value::Object()
// Precondition: (&EncryptionInfo).into() pattern matches Value::Object()
fn into(self) -> Value {
Expand Down Expand Up @@ -236,7 +236,7 @@ impl From<StratisInfo> for LStratisInfo {
}
}

impl<'a> Into<Value> for &'a LStratisInfo {
impl Into<Value> for &LStratisInfo {
// Precondition: (&StratisInfo).into() pattern matches Value::Object()
// Precondition: (&LLuksInfo).into() pattern matches Value::Object()
fn into(self) -> Value {
Expand Down Expand Up @@ -310,7 +310,7 @@ impl From<DeviceInfo> for LInfo {
}
}

impl<'a> Into<Value> for &'a LInfo {
impl Into<Value> for &LInfo {
// Precondition: (&LStratisInfo).into() pattern matches Value::Object()
// Precondition: (&LLuksInfo).into() pattern matches Value::Object()
fn into(self) -> Value {
Expand Down Expand Up @@ -820,7 +820,7 @@ impl DeviceSet {
}
}

impl<'a> Into<Value> for &'a DeviceSet {
impl Into<Value> for &DeviceSet {
fn into(self) -> Value {
Value::Array(self.internal.values().map(|info| info.into()).collect())
}
Expand Down Expand Up @@ -851,7 +851,7 @@ impl DeviceBag {
}
}

impl<'a> Into<Value> for &'a DeviceBag {
impl Into<Value> for &DeviceBag {
fn into(self) -> Value {
Value::Array(self.internal.iter().map(|info| info.into()).collect())
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/liminal/identify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct StratisDevInfo {
pub devnode: PathBuf,
}

impl<'a> Into<Value> for &'a StratisDevInfo {
impl Into<Value> for &StratisDevInfo {
// Precondition: (&StratisIdentifiers).into() pattern matches
// Value::Object()
fn into(self) -> Value {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/liminal/liminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ impl LiminalDevices {
}
}

impl<'a> Into<Value> for &'a LiminalDevices {
impl Into<Value> for &LiminalDevices {
fn into(self) -> Value {
json!({
"stopped_pools": Value::Array(
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/metadata/static_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl fmt::Display for StratisIdentifiers {
}
}

impl<'a> Into<Value> for &'a StratisIdentifiers {
impl Into<Value> for &StratisIdentifiers {
fn into(self) -> Value {
json!({
"pool_uuid": Value::from(self.pool_uuid.to_string()),
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/pool/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl StratPool {
}
}

impl<'a> Into<Value> for &'a StratPool {
impl Into<Value> for &StratPool {
// Precondition: (&ThinPool).into() pattern matches Value::Object(_)
// Precondition: (&Backstore).into() pattern matches Value::Object(_)
fn into(self) -> Value {
Expand Down Expand Up @@ -1319,7 +1319,7 @@ impl StateDiff for StratPoolState {
}
}

impl<'a> DumpState<'a> for StratPool {
impl DumpState<'_> for StratPool {
type State = StratPoolState;
type DumpInput = ();

Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/pool/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ impl StratPool {
}
}

impl<'a> Into<Value> for &'a StratPool {
impl Into<Value> for &StratPool {
// Precondition: (&ThinPool).into() pattern matches Value::Object(_)
// Precondition: (&Backstore).into() pattern matches Value::Object(_)
fn into(self) -> Value {
Expand Down Expand Up @@ -1227,7 +1227,7 @@ impl StateDiff for StratPoolState {
}
}

impl<'a> DumpState<'a> for StratPool {
impl DumpState<'_> for StratPool {
type State = StratPoolState;
type DumpInput = ();

Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/tests/real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn get_device_runs<'a>(

let avail = matches.len();
let needed = maybe_upper.unwrap_or(lower);
let must_generate = if avail > needed { 0 } else { needed - avail };
let must_generate = needed.saturating_sub(avail);
let avail_specs = {
let mut avail_specs = vec![];
while avail_specs.len() < must_generate && (!too_large.is_empty() || !matches.is_empty()) {
Expand Down
4 changes: 2 additions & 2 deletions src/engine/strat_engine/thinpool/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ impl StateDiff for StratFilesystemState {
}
}
}
impl<'a> DumpState<'a> for StratFilesystem {
impl DumpState<'_> for StratFilesystem {
type State = StratFilesystemState;
type DumpInput = ();

Expand Down Expand Up @@ -582,7 +582,7 @@ pub fn fs_usage(mount_point: &Path) -> StratisResult<(Bytes, Bytes)> {
))
}

impl<'a> Into<Value> for &'a StratFilesystem {
impl Into<Value> for &StratFilesystem {
fn into(self) -> Value {
let mut json = Map::new();
json.insert(
Expand Down
2 changes: 1 addition & 1 deletion src/engine/strat_engine/thinpool/thinpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ where
}
}

impl<'a, B> Into<Value> for &'a ThinPool<B> {
impl<B> Into<Value> for &ThinPool<B> {
fn into(self) -> Value {
json!({
"filesystems": Value::Array(
Expand Down
4 changes: 2 additions & 2 deletions src/engine/types/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Hash for EncryptionInfo {
}
}

impl<'a> Into<Value> for &'a EncryptionInfo {
impl Into<Value> for &EncryptionInfo {
fn into(self) -> Value {
let mut json = Map::new();
if let Some(kd) = self.key_description() {
Expand Down Expand Up @@ -369,7 +369,7 @@ impl TryFrom<String> for KeyDescription {
}
}

impl<'a> TryFrom<&'a String> for KeyDescription {
impl TryFrom<&String> for KeyDescription {
type Error = StratisError;

fn try_from(s: &String) -> StratisResult<KeyDescription> {
Expand Down

0 comments on commit 635e617

Please sign in to comment.