refactor: Bumping up to rust v1.90#5112
Conversation
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
crates/pixi_cli/src/install.rs
Outdated
| environment.name().fancy_display(), | ||
| ) | ||
| .unwrap(); | ||
| .into_diagnostic()?; |
There was a problem hiding this comment.
using into_diagnostic() here and everywhere else in this file as unwrap() makes cargo clippy unhappy.
There was a problem hiding this comment.
Instead of that we should use expect
| }))); | ||
| } | ||
| if let Ok(url) = url::Url::parse(value) | ||
| && let Some(archive) = ArchiveIdentifier::try_from_url(&url) |
There was a problem hiding this comment.
Another syntactic sugar that Clippy wants. There are a bunch of other places where I've refactored this.
| #[allow(dead_code)] | ||
| pub struct ParseExposedKeyError {} |
There was a problem hiding this comment.
clippy finds this unused.
There was a problem hiding this comment.
Feel free to delete it if it's truly unused
|
That one test failure looks like a fluke. @baszalmstra this is ready for review. |
baszalmstra
left a comment
There was a problem hiding this comment.
Make sure to also add the minimum supported rust version to the workspace cargo.toml. We use syntax now that is not supported by older versions. (if-let chains)
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
crates/pixi_cli/src/install.rs
Outdated
| .unwrap_or_else(|_| { | ||
| panic!( | ||
| "Cannot install the {} environment", | ||
| environment.name().fancy_display() | ||
| ) | ||
| }); |
There was a problem hiding this comment.
Used unwrap_or_else here as we can print a helpful error message, I've used expect("") in rest of the cases.
| license = "BSD-3-Clause" | ||
| readme = "README.md" | ||
| repository = "https://github.com/prefix-dev/pixi" | ||
| rust-version = "1.90" |
There was a problem hiding this comment.
Bumping up to 1.90 as MSRV.
baszalmstra
left a comment
There was a problem hiding this comment.
please add at least some reason to the expects instead of an empty string.
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
| #[derive(Debug, Error, Diagnostic)] | ||
| #[allow(dead_code)] | ||
| #[error("an error occurred while parsing the manifest")] | ||
| pub struct MultiTomlError { | ||
| #[related] | ||
| pub errors: Vec<TomlError>, | ||
| } | ||
|
|
||
| impl From<DeserError> for MultiTomlError { | ||
| fn from(value: DeserError) -> Self { | ||
| Self { | ||
| errors: value.errors.into_iter().map(Into::into).collect(), | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Removed since never used.
| env, | ||
| ) | ||
| .unwrap_or_else(|_| panic!("Cannot install the following environments: {}", env)); | ||
| .expect("failed to write into message buffer"); |
There was a problem hiding this comment.
It's highly unlikely we would ever get this error but had to be added since cargo-clipy is set to treat warnings as errors.
| /// Represents an error that occurs when parsing an binary exposed name. | ||
| /// | ||
| /// This error is returned when a string fails to be parsed as an environment | ||
| /// name. | ||
| #[derive(Debug, Clone, Error, Diagnostic, PartialEq)] | ||
| #[error("pixi is not allowed as exposed name in the map")] | ||
| #[allow(dead_code)] | ||
| pub struct ParseExposedKeyError {} | ||
|
|
There was a problem hiding this comment.
Removed since never used.
|
Thanks @prady0t ! |
Fixes #5109