You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -8,42 +8,113 @@ use std::path::{Path, PathBuf};
8
8
// This allows rust analyzer to analyze rustc internals and show proper information inside clippy
9
9
// code. See https://github.com/rust-analyzer/rust-analyzer/issues/3517 and https://github.com/rust-lang/rust-clippy/issues/5514 for details
10
10
11
-
/// # Panics
12
-
///
13
-
/// Panics if `rustc_path` does not lead to a rustc repo or the files could not be read
14
-
pubfnrun(rustc_path:Option<&str>){
15
-
// we can unwrap here because the arg is required by clap
16
-
let rustc_path = PathBuf::from(rustc_path.unwrap())
17
-
.canonicalize()
18
-
.expect("failed to get the absolute repo path");
19
-
assert!(rustc_path.is_dir(),"path is not a directory");
20
-
let rustc_source_basedir = rustc_path.join("compiler");
21
-
assert!(
22
-
rustc_source_basedir.is_dir(),
23
-
"are you sure the path leads to a rustc repo?"
24
-
);
25
-
26
-
let clippy_root_manifest = fs::read_to_string("Cargo.toml").expect("failed to read ./Cargo.toml");
27
-
let clippy_root_lib_rs = fs::read_to_string("src/driver.rs").expect("failed to read ./src/driver.rs");
28
-
inject_deps_into_manifest(
29
-
&rustc_source_basedir,
30
-
"Cargo.toml",
31
-
&clippy_root_manifest,
32
-
&clippy_root_lib_rs,
33
-
)
34
-
.expect("Failed to inject deps into ./Cargo.toml");
35
-
36
-
let clippy_lints_manifest =
37
-
fs::read_to_string("clippy_lints/Cargo.toml").expect("failed to read ./clippy_lints/Cargo.toml");
38
-
let clippy_lints_lib_rs =
39
-
fs::read_to_string("clippy_lints/src/lib.rs").expect("failed to read ./clippy_lints/src/lib.rs");
40
-
inject_deps_into_manifest(
41
-
&rustc_source_basedir,
42
-
"clippy_lints/Cargo.toml",
43
-
&clippy_lints_manifest,
44
-
&clippy_lints_lib_rs,
45
-
)
46
-
.expect("Failed to inject deps into ./clippy_lints/Cargo.toml");
0 commit comments