Skip to content

Commit

Permalink
rename Compat::Node to Compat::Npm
Browse files Browse the repository at this point in the history
Technically these are associated with the tools, not the languages.
dtolnay/semver#209 (comment)
  • Loading branch information
hone committed Sep 14, 2020
1 parent 513c4d3 commit 65d7268
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -7,8 +7,8 @@ fn main() -> Result<(), Box<dyn Error>> {
let range_set: RangeSet = "1.2.3".parse()?;
println!("Found range set: {:?}", range_set);

// node compatibility
let range_set = RangeSet::parse("1.2.3", Compat::Node)?;
// npm compatibility
let range_set = RangeSet::parse("1.2.3", Compat::Npm)?;
println!("Found range set (node): {:?}", range_set);

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/range.rs
Expand Up @@ -183,7 +183,7 @@ pub mod simple {
}
PartialKind::MajorMinorPatch => {
match compat {
range_set::Compat::Node => {
range_set::Compat::Npm => {
// for node, "1.2.3" is "=1.2.3"
comparators.push(partial.as_comparator(Op::Eq));
}
Expand Down Expand Up @@ -612,7 +612,7 @@ mod tests {
let (input, expected_range) = $value;

let parsed_range = parse_range(input);
let range = from_pair_iterator(parsed_range, range_set::Compat::Node).expect("parsing failed");
let range = from_pair_iterator(parsed_range, range_set::Compat::Npm).expect("parsing failed");

// get the expected length from the input range
let num_comparators = range.comparator_set.len();
Expand Down Expand Up @@ -676,7 +676,7 @@ mod tests {
},
)*
],
compat: range_set::Compat::Node
compat: range_set::Compat::Npm
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/range_set.rs
Expand Up @@ -12,7 +12,7 @@ pub struct RangeSet {
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Compat {
Cargo, // default
Node,
Npm,
}

impl RangeSet {
Expand Down Expand Up @@ -112,7 +112,7 @@ mod tests {
fn $name() {
let expected_sets = vec![$($x)*];

let range_set = RangeSet::parse($input, Compat::Node).expect("parse failed");
let range_set = RangeSet::parse($input, Compat::Npm).expect("parse failed");

assert_eq!(range_set.ranges.len(), expected_sets.len());
for it in range_set.ranges.iter().zip(expected_sets.iter()) {
Expand Down

0 comments on commit 65d7268

Please sign in to comment.