Skip to content
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: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
with:
shared-key: warm
- name: Install Dylint
if: false
uses: taiki-e/install-action@v2
with:
tool: cargo-dylint,dylint-link
Expand All @@ -50,11 +49,9 @@ jobs:
cargo +stable clippy --all-targets -- -D warnings
cargo +nightly-2025-05-14 clippy --all-targets --all-features -- -D warnings
- name: Dylint tests
if: false
working-directory: nova_lint
run: cargo test
- name: Dylint
if: false
run: cargo dylint --all

build:
Expand Down
2 changes: 1 addition & 1 deletion nova_lint/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[target.'cfg(all())']
rustflags = ["-C", "linker=dylint-link"]
linker = "dylint-link"
6 changes: 3 additions & 3 deletions nova_lint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ name = "gc_scope_is_only_passed_by_value"
path = "ui/gc_scope_is_only_passed_by_value.rs"

[dependencies]
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "ff4a26d442bead94a4c96fb1de967374bc4fbd8e" }
dylint_linting = { version = "4.0.0", features = ["constituent"] }
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "0450db33a5d8587f7c1d4b6d233dac963605766b" }
dylint_linting = { version = "4.1.0", features = ["constituent"] }

[dev-dependencies]
dylint_testing = "4.0.0"
dylint_testing = "4.1.0"
nova_vm = { path = "../nova_vm" }

[package.metadata.rust-analyzer]
Expand Down
19 changes: 18 additions & 1 deletion nova_lint/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
use clippy_utils::match_def_path;
use rustc_hir::def_id::DefId;
use rustc_lint::LateContext;
use rustc_middle::ty::{Ty, TyKind};
use rustc_span::symbol::Symbol;

// Copyright (c) 2014-2025 The Rust Project Developers
//
// Originally copied from `dylint` which in turn copied it from `clippy_utils`:
// - https://github.com/trailofbits/dylint/blob/a2dd5c60d53d66fc791fa8184bed27a4cb142e74/internal/src/match_def_path.rs
// - https://github.com/rust-lang/rust-clippy/blob/f62f26965817f2573c2649288faa489a03ed1665/clippy_utils/src/lib.rs
// It was removed from `clippy_utils` by the following PR:
// - https://github.com/rust-lang/rust-clippy/pull/14705
/// Checks if the given `DefId` matches the path.
pub fn match_def_path(cx: &LateContext<'_>, did: DefId, syms: &[&str]) -> bool {
// We should probably move to Symbols in Clippy as well rather than interning every time.
let path = cx.get_def_path(did);
syms.iter()
.map(|x| Symbol::intern(x))
.eq(path.iter().copied())
}

pub fn is_param_ty(ty: &Ty) -> bool {
matches!(ty.kind(), TyKind::Param(_))
Expand Down
Loading