-
-
Notifications
You must be signed in to change notification settings - Fork 25
fix clippy warnings #51
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
Open
ANAVHEOBA
wants to merge
2
commits into
gleam-lang:main
Choose a base branch
from
ANAVHEOBA:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,10 +48,18 @@ impl fmt::Display for Error { | |
| EmptyPredicate => write!(fmt, "encountered empty predicate"), | ||
| EmptyRange => write!(fmt, "encountered empty range"), | ||
| MinorVersionMissing(major) => { | ||
| write!(fmt, "missing minor and patch versions: {:?}", major) | ||
| write!( | ||
| fmt, | ||
| "incomplete version: {}.x.x - versions must follow MAJOR.MINOR.PATCH format (e.g., {}.0.0)", | ||
| major, major | ||
| ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes seem unrelated to clippy. Could you revert them please |
||
| } | ||
| PatchVersionMissing(major, minor) => { | ||
| write!(fmt, "missing patch version: {:?}.{:?}", major, minor) | ||
| write!( | ||
| fmt, | ||
| "incomplete version: {}.{}.x - versions must follow MAJOR.MINOR.PATCH format (e.g., {}.{}.0)", | ||
| major, minor, major, minor | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -469,3 +469,39 @@ fn missing_minor_has_correct_error_type() { | |
| fn missing_patch_has_correct_error_type() { | ||
| assert_eq!(Version::parse("1.2"), Err(Error::PatchVersionMissing(1, 2))) | ||
| } | ||
|
|
||
| // Tests for improved error messages from issue #35 | ||
| #[test] | ||
| fn range_incomplete_patch_left_side() { | ||
| let error = Range::new(">= 0.34".to_string()).unwrap_err(); | ||
| let error_msg = error.to_string(); | ||
| assert!(error_msg.contains("incomplete version")); | ||
| assert!(error_msg.contains("0.34")); | ||
| assert!(error_msg.contains("MAJOR.MINOR.PATCH")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn range_incomplete_patch_right_side() { | ||
| let error = Range::new("< 2.0".to_string()).unwrap_err(); | ||
| let error_msg = error.to_string(); | ||
| assert!(error_msg.contains("incomplete version")); | ||
| assert!(error_msg.contains("2.0")); | ||
| assert!(error_msg.contains("MAJOR.MINOR.PATCH")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn range_incomplete_patch_both_sides() { | ||
| let error = Range::new(">= 0.34 and < 2.0.0".to_string()).unwrap_err(); | ||
| let error_msg = error.to_string(); | ||
| assert!(error_msg.contains("incomplete version")); | ||
| assert!(error_msg.contains("0.34")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn range_incomplete_major_only() { | ||
| let error = Range::new(">= 1".to_string()).unwrap_err(); | ||
| let error_msg = error.to_string(); | ||
| assert!(error_msg.contains("incomplete version")); | ||
| assert!(error_msg.contains("1.x.x")); | ||
| assert!(error_msg.contains("1.0.0")); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These seem unrelated to clippy, please remove them |
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests no longer ensure the return type is unit. Add an annotation or similar to put back that test functionality please.