Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deps #8605

Merged
merged 3 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ name = "clippy-driver"
path = "src/driver.rs"

[dependencies]
clippy_lints = { version = "0.1", path = "clippy_lints" }
clippy_lints = { path = "clippy_lints" }
semver = "1.0"
rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }
rustc_tools_util = { path = "rustc_tools_util" }
tempfile = { version = "3.2", optional = true }

[dev-dependencies]
cargo_metadata = "0.14"
compiletest_rs = { version = "0.7.1", features = ["tmp"] }
tester = "0.9"
regex = "1.5"
Expand Down
7 changes: 4 additions & 3 deletions clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ version = "0.0.1"
edition = "2021"

[dependencies]
bytecount = "0.6"
clap = "2.33"
indoc = "1.0"
itertools = "0.10.1"
opener = "0.5"
regex = "1.5"
shell-escape = "0.1"
walkdir = "2.3"
cargo_metadata = "0.14"

[features]
deny-warnings = []

[package.metadata.rust-analyzer]
# This package uses #[feature(rustc_private)]
rustc_private = true
4 changes: 4 additions & 0 deletions clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#![feature(let_else)]
#![feature(once_cell)]
#![feature(rustc_private)]
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
// warn on lints, that are included in `rust-lang/rust`s bootstrap
#![warn(rust_2018_idioms, unused_lifetimes)]

extern crate rustc_lexer;

use std::path::PathBuf;

pub mod bless;
Expand Down
24 changes: 16 additions & 8 deletions clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,23 @@ fn to_camel_case(name: &str) -> String {
}

fn get_stabilisation_version() -> String {
let mut command = cargo_metadata::MetadataCommand::new();
command.no_deps();
if let Ok(metadata) = command.exec() {
if let Some(pkg) = metadata.packages.iter().find(|pkg| pkg.name == "clippy") {
return format!("{}.{}.0", pkg.version.minor, pkg.version.patch);
}
fn parse_manifest(contents: &str) -> Option<String> {
let version = contents
.lines()
.filter_map(|l| l.split_once('='))
.find_map(|(k, v)| (k.trim() == "version").then(|| v.trim()))?;
let Some(("0", version)) = version.get(1..version.len() - 1)?.split_once('.') else {
return None;
};
let (minor, patch) = version.split_once('.')?;
Some(format!(
"{}.{}.0",
minor.parse::<u32>().ok()?,
patch.parse::<u32>().ok()?
))
}

String::from("<TODO set version(see doc/adding_lints.md)>")
let contents = fs::read_to_string("Cargo.toml").expect("Unable to read `Cargo.toml`");
parse_manifest(&contents).expect("Unable to find package version in `Cargo.toml`")
}

fn get_test_file_contents(lint_name: &str, header_commands: Option<&str>) -> String {
Expand Down
Loading