-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #13123 - epage:pure, r=weihanglo
refactor: Clarify PackageId constructor names ### What does this PR try to resolve? From #13080 > I would love to see eithe rename this function or have a doc comment on it. It always puzzle me what pure means. From my experience, `new` is more normally a name for more direct construction when there are alternatives ### How should we test and review this PR? ### Additional information
- Loading branch information
Showing
10 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -714,7 +714,7 @@ mod tests { | |
let url = Url::parse("https://example.com").unwrap(); | ||
let sid = SourceId::for_registry(&url).unwrap(); | ||
|
||
let foo = PackageId::new("foo", "1.2.3", sid).unwrap(); | ||
let foo = PackageId::try_new("foo", "1.2.3", sid).unwrap(); | ||
assert!(PackageIdSpec::parse("foo").unwrap().matches(foo)); | ||
assert!(!PackageIdSpec::parse("bar").unwrap().matches(foo)); | ||
assert!(PackageIdSpec::parse("foo:1.2.3").unwrap().matches(foo)); | ||
|
@@ -735,7 +735,7 @@ mod tests { | |
.unwrap() | ||
.matches(foo)); | ||
|
||
let meta = PackageId::new("meta", "1.2.3+hello", sid).unwrap(); | ||
let meta = PackageId::try_new("meta", "1.2.3+hello", sid).unwrap(); | ||
assert!(PackageIdSpec::parse("meta").unwrap().matches(meta)); | ||
assert!(PackageIdSpec::parse("meta@1").unwrap().matches(meta)); | ||
assert!(PackageIdSpec::parse("[email protected]").unwrap().matches(meta)); | ||
|
@@ -750,7 +750,7 @@ mod tests { | |
.unwrap() | ||
.matches(meta)); | ||
|
||
let pre = PackageId::new("pre", "1.2.3-alpha.0", sid).unwrap(); | ||
let pre = PackageId::try_new("pre", "1.2.3-alpha.0", sid).unwrap(); | ||
assert!(PackageIdSpec::parse("pre").unwrap().matches(pre)); | ||
assert!(!PackageIdSpec::parse("pre@1").unwrap().matches(pre)); | ||
assert!(!PackageIdSpec::parse("[email protected]").unwrap().matches(pre)); | ||
|
This file contains 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 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 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 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 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 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 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