Skip to content

Commit

Permalink
refactor: flatten module path of SourceId
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Sep 7, 2023
1 parent b6c4e47 commit e575448
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/resolver-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use std::time::Instant;

use cargo::core::dependency::DepKind;
use cargo::core::resolver::{self, ResolveOpts, VersionPreferences};
use cargo::core::source::{GitReference, SourceId};
use cargo::core::Resolve;
use cargo::core::{Dependency, PackageId, Registry, Summary};
use cargo::core::{GitReference, SourceId};
use cargo::sources::source::QueryKind;
use cargo::util::{CargoResult, Config, Graph, IntoUrl, PartialVersion};

Expand Down
4 changes: 2 additions & 2 deletions src/cargo/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use self::package_id_spec::PackageIdSpec;
pub use self::registry::Registry;
pub use self::resolver::{Resolve, ResolveVersion};
pub use self::shell::{Shell, Verbosity};
pub use self::source::{GitReference, SourceId};
pub use self::source_id::{GitReference, SourceId};
pub use self::summary::{FeatureMap, FeatureValue, Summary};
pub use self::workspace::{
find_workspace_root, resolve_relative_path, MaybePackage, Workspace, WorkspaceConfig,
Expand All @@ -27,6 +27,6 @@ pub mod profiles;
pub mod registry;
pub mod resolver;
pub mod shell;
pub mod source;
mod source_id;
pub mod summary;
mod workspace;
4 changes: 2 additions & 2 deletions src/cargo/core/package_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::OnceLock;
use serde::de;
use serde::ser;

use crate::core::source::SourceId;
use crate::core::SourceId;
use crate::util::interning::InternedString;
use crate::util::{CargoResult, ToSemver};

Expand Down Expand Up @@ -238,7 +238,7 @@ impl fmt::Debug for PackageId {
#[cfg(test)]
mod tests {
use super::PackageId;
use crate::core::source::SourceId;
use crate::core::SourceId;
use crate::sources::CRATES_IO_INDEX;
use crate::util::IntoUrl;

Expand Down
3 changes: 0 additions & 3 deletions src/cargo/core/source/mod.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static SOURCE_ID_CACHE: OnceLock<Mutex<HashSet<&'static SourceIdInner>>> = OnceL
///
/// [`Source`]: crate::sources::source::Source
/// [`Source::source_id`]: crate::sources::source::Source::source_id
/// [`PackageId`]: super::super::PackageId
/// [`PackageId`]: super::PackageId
#[derive(Clone, Copy, Eq, Debug)]
pub struct SourceId {
inner: &'static SourceIdInner,
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/git/source.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! See [GitSource].

use crate::core::source::SourceId;
use crate::core::GitReference;
use crate::core::SourceId;
use crate::core::{Dependency, Package, PackageId, Summary};
use crate::sources::git::utils::GitRemote;
use crate::sources::source::MaybePackage;
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/profile_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ fn named_config_profile() {
let ws = Workspace::new(&paths::root().join("Cargo.toml"), &config).unwrap();
let profiles = Profiles::new(&ws, profile_name).unwrap();

let crates_io = cargo::core::source::SourceId::crates_io(&config).unwrap();
let crates_io = cargo::core::SourceId::crates_io(&config).unwrap();
let a_pkg = PackageId::new("a", "0.1.0", crates_io).unwrap();
let dep_pkg = PackageId::new("dep", "0.1.0", crates_io).unwrap();

Expand Down

0 comments on commit e575448

Please sign in to comment.