forked from rust-lang/rustup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rs
73 lines (65 loc) · 1.76 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#![recursion_limit = "1024"]
#[macro_use]
extern crate error_chain;
extern crate itertools;
#[cfg(unix)]
extern crate libc;
extern crate regex;
extern crate rustup_dist;
extern crate rustup_utils;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate tempfile;
extern crate time;
extern crate toml;
extern crate url;
pub use crate::config::*;
pub use crate::errors::*;
pub use crate::notifications::*;
pub use crate::toolchain::*;
pub use rustup_utils::{notify, toml_utils, utils};
// A list of all binaries which Rustup will proxy.
pub static TOOLS: &'static [&'static str] = &[
"rustc",
"rustdoc",
"cargo",
"rust-lldb",
"rust-gdb",
"rls",
"cargo-clippy",
"cargo-miri",
];
// Tools which are commonly installed by Cargo as well as rustup. We take a bit
// more care with these to ensure we don't overwrite the user's previous
// installation.
pub static DUP_TOOLS: &'static [&'static str] = &["rustfmt", "cargo-fmt"];
fn component_for_bin(binary: &str) -> Option<&'static str> {
use std::env::consts::EXE_SUFFIX;
let binary_prefix = match binary.find(EXE_SUFFIX) {
_ if EXE_SUFFIX.is_empty() => binary,
Some(i) => &binary[..i],
None => binary,
};
match binary_prefix {
"rustc" | "rustdoc" => Some("rustc"),
"cargo" => Some("cargo"),
"rust-lldb" => Some("lldb-preview"),
"rust-gdb" => Some("gdb-preview"),
"rls" => Some("rls"),
"cargo-clippy" => Some("clippy"),
"cargo-miri" => Some("miri"),
"rustfmt" | "cargo-fmt" => Some("rustfmt"),
_ => None,
}
}
pub mod command;
mod config;
pub mod env_var;
mod errors;
mod install;
mod notifications;
pub mod settings;
pub mod telemetry;
pub mod telemetry_analysis;
mod toolchain;