Port clippy away from compiletest to ui_test
This commit is contained in:
parent
78e36d9f53
commit
514b6d04bb
14 changed files with 208 additions and 392 deletions
|
|
@ -2397,7 +2397,7 @@ fn with_test_item_names(tcx: TyCtxt<'_>, module: LocalDefId, f: impl Fn(&[Symbol
|
|||
|
||||
/// Checks if the function containing the given `HirId` is a `#[test]` function
|
||||
///
|
||||
/// Note: Add `// compile-flags: --test` to UI tests with a `#[test]` function
|
||||
/// Note: Add `//@compile-flags: --test` to UI tests with a `#[test]` function
|
||||
pub fn is_in_test_function(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
|
||||
with_test_item_names(tcx, tcx.parent_module(id), |names| {
|
||||
tcx.hir()
|
||||
|
|
@ -2419,7 +2419,7 @@ pub fn is_in_test_function(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
|
|||
|
||||
/// Checks if the item containing the given `HirId` has `#[cfg(test)]` attribute applied
|
||||
///
|
||||
/// Note: Add `// compile-flags: --test` to UI tests with a `#[cfg(test)]` function
|
||||
/// Note: Add `//@compile-flags: --test` to UI tests with a `#[cfg(test)]` function
|
||||
pub fn is_in_cfg_test(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
|
||||
fn is_cfg_test(attr: &Attribute) -> bool {
|
||||
if attr.has_name(sym::cfg)
|
||||
|
|
@ -2441,7 +2441,7 @@ pub fn is_in_cfg_test(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
|
|||
/// Checks whether item either has `test` attribute applied, or
|
||||
/// is a module with `test` in its name.
|
||||
///
|
||||
/// Note: Add `// compile-flags: --test` to UI tests with a `#[test]` function
|
||||
/// Note: Add `//@compile-flags: --test` to UI tests with a `#[test]` function
|
||||
pub fn is_test_module_or_function(tcx: TyCtxt<'_>, item: &Item<'_>) -> bool {
|
||||
is_in_test_function(tcx, item.hir_id())
|
||||
|| matches!(item.kind, ItemKind::Mod(..))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue