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
use std::fs;
use std::path::Path;
const ALLOWED_SOURCES: &[&str] = &["\"registry+https://github.com/rust-lang/crates.io-index\""];
pub fn check(root: &Path, bad: &mut bool) {
let path = root.join("Cargo.lock");
let cargo_lock = t!(fs::read_to_string(&path));
for line in cargo_lock.lines() {
if !line.starts_with("source = ") {
continue;
}
let source = line.split_once('=').unwrap().1.trim();
if !ALLOWED_SOURCES.contains(&&*source) {
tidy_error!(bad, "invalid source: {}", source);
}
}
}