Skip to content

Commit 87dd91b

Browse files
authored
Merge pull request #1642 from dwijnand/rm-telemetry
Remove telemetry
2 parents a107c9f + f84b79f commit 87dd91b

19 files changed

+11
-991
lines changed

Cargo.lock

-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

-4
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ regex = "1.0.1"
4646
remove_dir_all = "0.5.1"
4747
same-file = "1.0"
4848
scopeguard = "0.3"
49-
serde = { version = "1.0.87", features = ['derive'] }
50-
serde_derive = "1.0"
51-
serde_json = "1.0"
5249
sha2 = "0.7.0"
5350
tempdir = "0.3.4"
54-
tempfile = "3.0.2"
5551
term = "0.5.1"
5652
time = "0.1.34"
5753
toml = "0.4"

src/rustup-cli/common.rs

-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use crate::errors::*;
44
use crate::self_update;
55
use crate::term2;
6-
use rustup::telemetry_analysis::TelemetryAnalysis;
76
use rustup::{Cfg, Notification, Toolchain, UpdateStatus};
87
use rustup_utils::notify::NotificationLevel;
98
use rustup_utils::utils;
@@ -433,11 +432,3 @@ pub fn report_error(e: &Error) {
433432
false
434433
}
435434
}
436-
437-
pub fn show_telemetry(analysis: TelemetryAnalysis) -> Result<()> {
438-
println!("Telemetry Analysis");
439-
440-
println!("{}", analysis);
441-
442-
Ok(())
443-
}

src/rustup-cli/proxy_mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ fn direct_proxy(
5757
None => cfg.create_command_for_dir(&utils::current_dir()?, arg0)?,
5858
Some(tc) => cfg.create_command_for_toolchain(tc, false, arg0)?,
5959
};
60-
Ok(run_command_for_dir(cmd, arg0, args, &cfg)?)
60+
Ok(run_command_for_dir(cmd, arg0, args)?)
6161
}

src/rustup-cli/rustup_mode.rs

+1-31
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::help::*;
44
use crate::self_update;
55
use crate::term2;
66
use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, Shell, SubCommand};
7-
use rustup::settings::TelemetryMode;
87
use rustup::{command, Cfg, Toolchain};
98
use rustup_dist::dist::{PartialTargetTriple, PartialToolchainDesc, TargetTriple};
109
use rustup_dist::manifest::Component;
@@ -80,12 +79,6 @@ pub fn main() -> Result<()> {
8079
("uninstall", Some(m)) => self_uninstall(m)?,
8180
(_, _) => unreachable!(),
8281
},
83-
("telemetry", Some(c)) => match c.subcommand() {
84-
("enable", Some(_)) => set_telemetry(&cfg, TelemetryMode::On)?,
85-
("disable", Some(_)) => set_telemetry(&cfg, TelemetryMode::Off)?,
86-
("analyze", Some(_)) => analyze_telemetry(&cfg)?,
87-
(_, _) => unreachable!(),
88-
},
8982
("set", Some(c)) => match c.subcommand() {
9083
("default-host", Some(m)) => set_default_host_triple(&cfg, m)?,
9184
(_, _) => unreachable!(),
@@ -462,17 +455,6 @@ pub fn cli() -> App<'static, 'static> {
462455
SubCommand::with_name("upgrade-data").about("Upgrade the internal data format."),
463456
),
464457
)
465-
.subcommand(
466-
SubCommand::with_name("telemetry")
467-
.about("rustup telemetry commands")
468-
.setting(AppSettings::Hidden)
469-
.setting(AppSettings::VersionlessSubcommands)
470-
.setting(AppSettings::DeriveDisplayOrder)
471-
.setting(AppSettings::SubcommandRequiredElseHelp)
472-
.subcommand(SubCommand::with_name("enable").about("Enable rustup telemetry"))
473-
.subcommand(SubCommand::with_name("disable").about("Disable rustup telemetry"))
474-
.subcommand(SubCommand::with_name("analyze").about("Analyze stored telemetry")),
475-
)
476458
.subcommand(
477459
SubCommand::with_name("set")
478460
.about("Alter rustup settings")
@@ -653,7 +635,7 @@ fn run(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
653635
let args: Vec<_> = args.collect();
654636
let cmd = cfg.create_command_for_toolchain(toolchain, m.is_present("install"), args[0])?;
655637

656-
let ExitCode(c) = command::run_command_for_dir(cmd, args[0], &args[1..], &cfg)?;
638+
let ExitCode(c) = command::run_command_for_dir(cmd, args[0], &args[1..])?;
657639

658640
process::exit(c)
659641
}
@@ -1052,18 +1034,6 @@ fn self_uninstall(m: &ArgMatches<'_>) -> Result<()> {
10521034
self_update::uninstall(no_prompt)
10531035
}
10541036

1055-
fn set_telemetry(cfg: &Cfg, t: TelemetryMode) -> Result<()> {
1056-
match t {
1057-
TelemetryMode::On => Ok(cfg.set_telemetry(true)?),
1058-
TelemetryMode::Off => Ok(cfg.set_telemetry(false)?),
1059-
}
1060-
}
1061-
1062-
fn analyze_telemetry(cfg: &Cfg) -> Result<()> {
1063-
let analysis = cfg.analyze_telemetry()?;
1064-
common::show_telemetry(analysis)
1065-
}
1066-
10671037
fn set_default_host_triple(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
10681038
cfg.set_default_host_triple(m.value_of("host_triple").expect(""))?;
10691039
Ok(())

src/rustup-mock/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ tempdir = "0.3.4"
2020
tar = "0.4.0"
2121
toml = "0.4"
2222
sha2 = "0.7.0"
23-
wait-timeout = "0.1.3"
2423

2524
[target."cfg(windows)".dependencies]
2625
winapi = "0.3"

src/rustup-mock/src/clitools.rs

+1-22
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ use std::fs::{self, File};
1616
use std::io::{self, Read, Write};
1717
use std::mem;
1818
use std::path::{Path, PathBuf};
19-
use std::process::{Command, Stdio};
19+
use std::process::Command;
2020
use std::sync::Arc;
21-
use std::time::Duration;
2221
use tempdir::TempDir;
2322
use url::Url;
24-
use wait_timeout::ChildExt;
2523

2624
/// The configuration used by the tests in this module
2725
pub struct Config {
@@ -253,25 +251,6 @@ pub fn expect_ok_contains(config: &Config, args: &[&str], stdout: &str, stderr:
253251
}
254252
}
255253

256-
pub fn expect_timeout_ok(config: &Config, timeout: Duration, args: &[&str]) {
257-
let mut child = cmd(config, args[0], &args[1..])
258-
.stdout(Stdio::null())
259-
.stderr(Stdio::null())
260-
.spawn()
261-
.unwrap();
262-
263-
match child.wait_timeout(timeout).unwrap() {
264-
Some(status) => {
265-
assert!(status.success(), "not ok {:?}", args);
266-
}
267-
None => {
268-
// child hasn't exited yet
269-
child.kill().unwrap();
270-
panic!("command timed out: {:?}", args);
271-
}
272-
}
273-
}
274-
275254
fn print_command(args: &[&str], out: &SanitizedOutput) {
276255
print!("\n>");
277256
for arg in args {

src/rustup-utils/src/toml_utils.rs

-12
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ pub fn get_bool(table: &mut toml::value::Table, key: &str, path: &str) -> Result
4242
})
4343
}
4444

45-
pub fn get_opt_bool(table: &mut toml::value::Table, key: &str, path: &str) -> Result<Option<bool>> {
46-
if let Ok(v) = get_value(table, key, path) {
47-
if let toml::Value::Boolean(b) = v {
48-
Ok(Some(b))
49-
} else {
50-
Err(ErrorKind::ExpectedType("bool", path.to_owned() + key).into())
51-
}
52-
} else {
53-
Ok(None)
54-
}
55-
}
56-
5745
pub fn get_table(
5846
table: &mut toml::value::Table,
5947
key: &str,

0 commit comments

Comments
 (0)