Skip to content

Commit 1196554

Browse files
djcrami3l
authored andcommitted
Remove derivative dependency in favor of manual implementation
1 parent bcccd3e commit 1196554

File tree

4 files changed

+36
-49
lines changed

4 files changed

+36
-49
lines changed

Cargo.lock

Lines changed: 16 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ cfg-if = "1.0"
4848
chrono = { version = "0.4", default-features = false, features = ["std"] }
4949
clap = { version = "4", features = ["wrap_help"] }
5050
clap_complete = "4"
51-
derivative.workspace = true
5251
download = { path = "download", default-features = false }
5352
effective-limits = "0.5.5"
5453
enum-map = "2.5.0"
@@ -160,7 +159,6 @@ members = ["download", "rustup-macros"]
160159

161160
[workspace.dependencies]
162161
anyhow = "1.0.69"
163-
derivative = "2.2.0"
164162
enum_dispatch = "0.3.11"
165163
fs_at = "0.1.6"
166164
once_cell = "1.18.0"

src/config.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use std::borrow::Cow;
2-
use std::fmt::{self, Display};
2+
use std::fmt::{self, Debug, Display};
33
use std::io;
44
use std::path::{Path, PathBuf};
55
use std::process::Command;
66
use std::str::FromStr;
77
use std::sync::Arc;
88

99
use anyhow::{anyhow, bail, Context, Result};
10-
use derivative::Derivative;
1110
use serde::Deserialize;
1211
use thiserror::Error as ThisError;
1312

@@ -172,8 +171,6 @@ impl OverrideCfg {
172171

173172
pub(crate) const UNIX_FALLBACK_SETTINGS: &str = "/etc/rustup/settings.toml";
174173

175-
#[derive(Derivative)]
176-
#[derivative(Debug)]
177174
pub(crate) struct Cfg {
178175
profile_override: Option<dist::Profile>,
179176
pub rustup_dir: PathBuf,
@@ -186,7 +183,6 @@ pub(crate) struct Cfg {
186183
pub toolchain_override: Option<ResolvableToolchainName>,
187184
pub env_override: Option<LocalToolchainName>,
188185
pub dist_root_url: String,
189-
#[derivative(Debug = "ignore")]
190186
pub notify_handler: Arc<dyn Fn(Notification<'_>)>,
191187
}
192188

@@ -955,6 +951,24 @@ impl Cfg {
955951
}
956952
}
957953

954+
impl Debug for Cfg {
955+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
956+
f.debug_struct("Cfg")
957+
.field("profile_override", &self.profile_override)
958+
.field("rustup_dir", &self.rustup_dir)
959+
.field("settings_file", &self.settings_file)
960+
.field("fallback_settings", &self.fallback_settings)
961+
.field("toolchains_dir", &self.toolchains_dir)
962+
.field("update_hash_dir", &self.update_hash_dir)
963+
.field("download_dir", &self.download_dir)
964+
.field("temp_cfg", &self.temp_cfg)
965+
.field("toolchain_override", &self.toolchain_override)
966+
.field("env_override", &self.env_override)
967+
.field("dist_root_url", &self.dist_root_url)
968+
.finish()
969+
}
970+
}
971+
958972
fn get_default_host_triple(s: &Settings) -> dist::TargetTriple {
959973
s.default_host_triple
960974
.as_ref()

src/toolchain/toolchain.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::{
1010
};
1111

1212
use anyhow::{anyhow, bail};
13-
use derivative::Derivative;
1413
use fs_at::OpenOptions;
1514
use wait_timeout::ChildExt;
1615

@@ -30,8 +29,7 @@ use super::{
3029
};
3130

3231
/// A toolchain installed on the local disk
33-
#[derive(Derivative)]
34-
#[derivative(Clone, Debug)]
32+
#[derive(Clone, Debug)]
3533
pub(crate) struct Toolchain<'a> {
3634
cfg: &'a Cfg,
3735
name: LocalToolchainName,

0 commit comments

Comments
 (0)