Skip to content

Commit

Permalink
Replace From<&Asset> trait with Clone
Browse files Browse the repository at this point in the history
  • Loading branch information
chshersh committed Sep 12, 2022
1 parent d482e1b commit f11f7b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions src/model/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,9 @@ pub struct Release {
pub assets: Vec<Asset>,
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize, Debug, Clone)]
pub struct Asset {
pub id: u32,
pub name: String,
pub size: u64,
}

impl From<&Asset> for Asset {
fn from(other: &Asset) -> Self {
Asset {
id: other.id,
name: other.name.clone(),
size: other.size,
}
}
}
2 changes: 1 addition & 1 deletion src/model/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl ToolInfo {

match asset {
None => Err(format!("No asset matching name: {}", asset_name)),
Some(asset) => Ok(Asset::from(asset)),
Some(asset) => Ok(asset.clone()),
}
}
}
Expand Down

0 comments on commit f11f7b5

Please sign in to comment.