Added note about the usage of clippy_utils::path

This commit is contained in:
xFrednet 2021-11-04 13:27:08 +01:00
parent a276cd2a00
commit 540515220d
No known key found for this signature in database
GPG Key ID: FCDCBF29AF64D601

View File

@ -105,6 +105,7 @@ impl LateLintPass<'_> for MyStructLint {
}
// 3. Using the type path
// This method should be avoided if possible
if match_def_path(cx, def_id, &paths::RESULT) {
// The type is a `core::result::Result`
}
@ -142,6 +143,7 @@ impl LateLintPass<'_> for MyStructLint {
// 3. Using the type path with the expression
// we use `match_trait_method` function from Clippy's utils
// (This method should be avoided if possible)
if match_trait_method(cx, expr, &paths::INTO) {
// `expr` implements `Into` trait
}