Skip to content

Commit

Permalink
Renamed registry/version items
Browse files Browse the repository at this point in the history
  • Loading branch information
tonowak committed Feb 9, 2023
1 parent 2449acd commit 8485cc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ impl Rustdoc {
/// Generate the rustdoc file from the largest-numbered non-yanked non-prerelease version
/// published to the cargo registry. If no such version, uses
/// the largest-numbered version including yanked and prerelease versions.
pub fn from_latest_version() -> Self {
pub fn from_registry_latest_crate_version() -> Self {
Self {
source: RustdocSource::Version(None),
source: RustdocSource::VersionFromRegistry(None),
}
}

/// Generate the rustdoc file from a specific crate version.
pub fn from_version(version: impl Into<String>) -> Self {
pub fn from_registry(crate_version: impl Into<String>) -> Self {
Self {
source: RustdocSource::Version(Some(version.into())),
source: RustdocSource::VersionFromRegistry(Some(crate_version.into())),
}
}
}
Expand All @@ -98,7 +98,7 @@ enum RustdocSource {
/// If `None`, uses the largest-numbered non-yanked non-prerelease version
/// published to the cargo registry. If no such version, uses
/// the largest-numbered version including yanked and prerelease versions.
Version(Option<String>),
VersionFromRegistry(Option<String>),
}

/// Which packages to analyze.
Expand Down Expand Up @@ -208,7 +208,7 @@ impl Check {
Self {
scope: Scope::default(),
current,
baseline: Rustdoc::from_latest_version(),
baseline: Rustdoc::from_registry_latest_crate_version(),
log_level: Default::default(),
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ impl Check {
config,
)?)
}
RustdocSource::Version(version) => {
RustdocSource::VersionFromRegistry(version) => {
let mut registry = rustdoc_gen::RustdocFromRegistry::new(&target_dir, config)?;
if let Some(ver) = version {
let semver = semver::Version::parse(ver)?;
Expand All @@ -300,7 +300,7 @@ impl Check {
let all_outcomes: Vec<anyhow::Result<bool>> = match &self.current.source {
RustdocSource::Rustdoc(_)
| RustdocSource::Revision(_, _)
| RustdocSource::Version(_) => {
| RustdocSource::VersionFromRegistry(_) => {
let name = "<unknown>";
let version = None;
let (current_crate, baseline_crate) = generate_versioned_crates(
Expand Down Expand Up @@ -484,6 +484,6 @@ fn get_target_dir_from_project_root(source: &RustdocSource) -> anyhow::Result<Op
Some(target)
}
RustdocSource::Rustdoc(_path) => None,
RustdocSource::Version(_version) => None,
RustdocSource::VersionFromRegistry(_version) => None,
})
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl From<CheckRelease> for cargo_semver_checks::Check {
}
let baseline = {
if let Some(baseline_version) = value.baseline_version {
Rustdoc::from_version(baseline_version)
Rustdoc::from_registry(baseline_version)
} else if let Some(baseline_rev) = value.baseline_rev {
let root = if let Some(baseline_root) = value.baseline_root {
baseline_root
Expand Down

0 comments on commit 8485cc5

Please sign in to comment.