Skip to content

Commit 67b5aa4

Browse files
committed
refactor(context): Rename config mod to context
1 parent c8b1074 commit 67b5aa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+65
-65
lines changed

crates/xtask-bump-check/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn main() {
66
let cli = xtask::cli();
77
let matches = cli.get_matches();
88

9-
let mut gctx = cargo::util::config::GlobalContext::default().unwrap_or_else(|e| {
9+
let mut gctx = cargo::util::context::GlobalContext::default().unwrap_or_else(|e| {
1010
let mut eval = cargo::core::shell::Shell::new();
1111
cargo::exit_with_error(e.into(), &mut eval)
1212
});

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anyhow::{anyhow, Context as _};
22
use cargo::core::{features, CliUnstable};
3-
use cargo::util::config::TermConfig;
3+
use cargo::util::context::TermConfig;
44
use cargo::{drop_print, drop_println, CargoResult};
55
use clap::builder::UnknownArgumentValueParser;
66
use itertools::Itertools;

src/cargo/core/compiler/build_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::core::compiler::CompileKind;
2-
use crate::util::config::JobsConfig;
2+
use crate::util::context::JobsConfig;
33
use crate::util::interning::InternedString;
44
use crate::util::{CargoResult, GlobalContext, RustfixDiagnosticServer};
55
use anyhow::{bail, Context as _};

src/cargo/core/compiler/build_context/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::core::compiler::{BuildConfig, CompileKind, Unit};
55
use crate::core::profiles::Profiles;
66
use crate::core::PackageSet;
77
use crate::core::Workspace;
8-
use crate::util::config::GlobalContext;
8+
use crate::util::context::GlobalContext;
99
use crate::util::errors::CargoResult;
1010
use crate::util::interning::InternedString;
1111
use crate::util::Rustc;

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::core::compiler::{
1212
BuildOutput, BuildRunner, CompileKind, CompileMode, CompileTarget, CrateType,
1313
};
1414
use crate::core::{Dependency, Package, Target, TargetKind, Workspace};
15-
use crate::util::config::{GlobalContext, StringList, TargetConfig};
15+
use crate::util::context::{GlobalContext, StringList, TargetConfig};
1616
use crate::util::interning::InternedString;
1717
use crate::util::{CargoResult, Rustc};
1818
use anyhow::Context as _;

src/cargo/core/compiler/compilation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::core::compiler::apply_env_config;
1111
use crate::core::compiler::BuildContext;
1212
use crate::core::compiler::{CompileKind, Metadata, Unit};
1313
use crate::core::Package;
14-
use crate::util::{config, CargoResult, GlobalContext};
14+
use crate::util::{context, CargoResult, GlobalContext};
1515

1616
/// Represents the kind of process we are creating.
1717
#[derive(Debug)]
@@ -453,7 +453,7 @@ fn target_runner(
453453
// try target.{}.runner
454454
let key = format!("target.{}.runner", target);
455455

456-
if let Some(v) = bcx.gctx.get::<Option<config::PathAndArgs>>(&key)? {
456+
if let Some(v) = bcx.gctx.get::<Option<context::PathAndArgs>>(&key)? {
457457
let path = v.path.resolve_program(bcx.gctx);
458458
return Ok(Some((path, v.args)));
459459
}

src/cargo/core/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
//! and summarize it similar to the other entries. Update the rest of the
113113
//! documentation to add the new feature.
114114
//!
115-
//! [`GlobalContext::cli_unstable`]: crate::util::config::GlobalContext::cli_unstable
115+
//! [`GlobalContext::cli_unstable`]: crate::util::context::GlobalContext::cli_unstable
116116
//! [`fail_if_stable_opt`]: CliUnstable::fail_if_stable_opt
117117
//! [`features!`]: macro.features.html
118118
//! [`unstable_cli_options!`]: macro.unstable_cli_options.html

src/cargo/core/profiles.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::core::{
3030
};
3131
use crate::util::interning::InternedString;
3232
use crate::util::toml::validate_profile;
33-
use crate::util::{closest_msg, config, CargoResult, GlobalContext};
33+
use crate::util::{closest_msg, context, CargoResult, GlobalContext};
3434
use anyhow::{bail, Context as _};
3535
use cargo_util_schemas::manifest::TomlTrimPaths;
3636
use cargo_util_schemas::manifest::TomlTrimPathsValue;
@@ -1298,7 +1298,7 @@ fn merge_config_profiles(
12981298

12991299
/// Helper for fetching a profile from config.
13001300
fn get_config_profile(ws: &Workspace<'_>, name: &str) -> CargoResult<Option<TomlProfile>> {
1301-
let profile: Option<config::Value<TomlProfile>> =
1301+
let profile: Option<context::Value<TomlProfile>> =
13021302
ws.gctx().get(&format!("profile.{}", name))?;
13031303
let Some(profile) = profile else {
13041304
return Ok(None);

src/cargo/core/resolver/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use tracing::{debug, trace};
6767

6868
use crate::core::PackageIdSpec;
6969
use crate::core::{Dependency, PackageId, Registry, Summary};
70-
use crate::util::config::GlobalContext;
70+
use crate::util::context::GlobalContext;
7171
use crate::util::errors::CargoResult;
7272
use crate::util::network::PollExt;
7373
use crate::util::profile;

src/cargo/core/source_id.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::sources::source::Source;
66
use crate::sources::{DirectorySource, CRATES_IO_DOMAIN, CRATES_IO_INDEX, CRATES_IO_REGISTRY};
77
use crate::sources::{GitSource, PathSource, RegistrySource};
88
use crate::util::interning::InternedString;
9-
use crate::util::{config, CanonicalUrl, CargoResult, GlobalContext, IntoUrl};
9+
use crate::util::{context, CanonicalUrl, CargoResult, GlobalContext, IntoUrl};
1010
use anyhow::Context as _;
1111
use serde::de;
1212
use serde::ser;
@@ -268,7 +268,7 @@ impl SourceId {
268268

269269
/// Returns whether to access crates.io over the sparse protocol.
270270
pub fn crates_io_is_sparse(gctx: &GlobalContext) -> CargoResult<bool> {
271-
let proto: Option<config::Value<String>> = gctx.get("registries.crates-io.protocol")?;
271+
let proto: Option<context::Value<String>> = gctx.get("registries.crates-io.protocol")?;
272272
let is_sparse = match proto.as_ref().map(|v| v.val.as_str()) {
273273
Some("sparse") => true,
274274
Some("git") => false,

0 commit comments

Comments
 (0)