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

Transition away from home #1454

Merged
merged 4 commits into from
Dec 24, 2024
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
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ git2 = "0.18"
glob = "0.3"
heck = "0.5"
hex = "0.4"
home = "0.5"
home = "=0.5.9"
if_chain = "1.0"
is-terminal = "0.4"
log = "0.4"
Expand All @@ -45,6 +45,7 @@ predicates = "3.1"
regex = "1.11"
rewriter = "0.1"
rust-embed = "8.5"
rustversion = "1.0"
semver = "1.0"
serde = "1.0"
serde-untagged = "0.1"
Expand Down
1 change: 0 additions & 1 deletion cargo-dylint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ assert_cmd = { workspace = true }
cargo_metadata = { workspace = true }
ctor = { workspace = true }
glob = { workspace = true }
home = { workspace = true }
log = { workspace = true }
once_cell = { workspace = true }
predicates = { workspace = true }
Expand Down
13 changes: 5 additions & 8 deletions cargo-dylint/tests/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
use anyhow::Result;
use assert_cmd::Command;
use cargo_metadata::{Dependency, Metadata, MetadataCommand};
use dylint_internal::{cargo::current_metadata, env, examples};
use dylint_internal::{cargo::current_metadata, env, examples, home};
use once_cell::sync::Lazy;
use regex::Regex;
use semver::Version;
use semver::{Op, Version};
use similar_asserts::SimpleDiff;
use std::{
env::{set_current_dir, set_var, var},
Expand Down Expand Up @@ -97,7 +97,7 @@ fn versions_are_exact_and_match() {
}

#[test]
fn requirements_do_not_include_patch_versions() {
fn patch_version_requirements_are_exact() {
let metadata = ["driver", "utils/linting"].map(|path| {
MetadataCommand::new()
.current_dir(path)
Expand All @@ -109,14 +109,11 @@ fn requirements_do_not_include_patch_versions() {
for metadata in std::iter::once(&*METADATA).chain(metadata.iter()) {
for package in &metadata.packages {
for Dependency { name: dep, req, .. } in &package.dependencies {
if dep.starts_with("dylint") {
continue;
}
assert!(
req.comparators
.iter()
.all(|comparator| comparator.patch.is_none()),
"`{}` requirement on `{dep}` includes patch version: {req}",
.all(|comparator| comparator.op == Op::Exact || comparator.patch.is_none()),
"`{}` requirement on `{dep}` includes patch version and is not exact: {req}",
package.name
);
}
Expand Down
8 changes: 8 additions & 0 deletions cargo-dylint/tests/supply_chain/aarch64-apple-darwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,14 @@
"name": "Dan Gohman"
}
],
"rustversion": [
{
"id": 3618,
"kind": "user",
"login": "dtolnay",
"name": "David Tolnay"
}
],
"ryu": [
{
"id": 3618,
Expand Down
8 changes: 8 additions & 0 deletions cargo-dylint/tests/supply_chain/x86_64-apple-darwin.json
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,14 @@
"name": "Dan Gohman"
}
],
"rustversion": [
{
"id": 3618,
"kind": "user",
"login": "dtolnay",
"name": "David Tolnay"
}
],
"ryu": [
{
"id": 3618,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,14 @@
"name": "Dan Gohman"
}
],
"rustversion": [
{
"id": 3618,
"kind": "user",
"login": "dtolnay",
"name": "David Tolnay"
}
],
"ryu": [
{
"id": 3618,
Expand Down
3 changes: 1 addition & 2 deletions dylint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ fs_extra = { workspace = true, optional = true }
glob = { workspace = true, optional = true }
heck = { workspace = true, optional = true }
hex = { workspace = true, optional = true }
home = { workspace = true, optional = true }
if_chain = { workspace = true, optional = true }
is-terminal = { workspace = true }
log = { workspace = true }
Expand Down Expand Up @@ -72,10 +71,10 @@ __cargo_cli = [
"cargo-util",
"cargo-util-schemas",
"dunce",
"dylint_internal/home",
"fs_extra",
"glob",
"hex",
"home",
"if_chain",
"serde-untagged",
"toml",
Expand Down
3 changes: 1 addition & 2 deletions dylint/src/library_packages/cargo_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use crate::opts;
use anyhow::{anyhow, bail, ensure, Context, Result};
use cargo_metadata::{Metadata, MetadataCommand};
use cargo_util_schemas::manifest::TomlDetailedDependency;
use dylint_internal::{packaging::isolate, CommandExt};
use home::cargo_home;
use dylint_internal::{home::cargo_home, packaging::isolate, CommandExt};
use semver::Version;
use serde::Serialize;
use std::{
Expand Down
1 change: 1 addition & 0 deletions examples/experimental/derive_opportunity/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/general/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/general/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ members = [
bitflags = "2.6"
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "ff4a26d442bead94a4c96fb1de967374bc4fbd8e" }
derivative = "2.2.0"
home = "0.5"
once_cell = "1.20"
serde = "1.0"
serde_json = "1.0"
Expand Down
3 changes: 1 addition & 2 deletions examples/general/abs_home_path/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
clippy_utils = { workspace = true }
home = { workspace = true }
once_cell = { workspace = true }

dylint_internal = { path = "../../../internal" }
dylint_internal = { path = "../../../internal", features = ["home"] }
dylint_linting = { path = "../../../utils/linting" }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/general/abs_home_path/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extern crate rustc_hir;
extern crate rustc_span;

use clippy_utils::{diagnostics::span_lint, match_def_path, path_def_id};
use dylint_internal::paths;
use dylint_internal::{home, paths};
use once_cell::unsync::OnceCell;
use rustc_ast::ast::LitKind;
use rustc_hir::{def_id::DefId, Closure, Expr, ExprKind, Item, ItemKind, Node};
Expand Down
1 change: 1 addition & 0 deletions examples/restriction/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/supplementary/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/testing/clippy/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 32 additions & 11 deletions examples/testing/marker/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/testing/straggler/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading