nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: rust-analyzer/rust-analyzer
Pull request #4376 (2020-05-08 13:19:00)

Fix type of byte literals
They're `&[u8; N]`, not `&[u8]` (see #4374).


Patch:
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 83f946eeea..614c352a0c 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -501,8 +501,8 @@ impl<'a> InferenceContext<'a> {
                 }
                 Literal::ByteString(..) => {
                     let byte_type = Ty::simple(TypeCtor::Int(Uncertain::Known(IntTy::u8())));
-                    let slice_type = Ty::apply_one(TypeCtor::Slice, byte_type);
-                    Ty::apply_one(TypeCtor::Ref(Mutability::Shared), slice_type)
+                    let array_type = Ty::apply_one(TypeCtor::Array, byte_type);
+                    Ty::apply_one(TypeCtor::Ref(Mutability::Shared), array_type)
                 }
                 Literal::Char(..) => Ty::simple(TypeCtor::Char),
                 Literal::Int(_v, ty) => Ty::simple(TypeCtor::Int((*ty).into())),


Test patch:
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs
index ab87f598a6..67f964ab5d 100644
--- a/crates/ra_hir_ty/src/tests/method_resolution.rs
+++ b/crates/ra_hir_ty/src/tests/method_resolution.rs
@@ -17,8 +17,8 @@ impl<T> [T] {
 #[lang = "slice_alloc"]
 impl<T> [T] {}
 
-fn test() {
-    <[_]>::foo(b"foo");
+fn test(x: &[u8]) {
+    <[_]>::foo(x);
 }
 "#),
         @r###"
@@ -26,10 +26,11 @@ fn test() {
     56..79 '{     ...     }': T
     66..73 'loop {}': !
     71..73 '{}': ()
-    133..160 '{     ...o"); }': ()
-    139..149 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8
-    139..157 '<[_]>:..."foo")': u8
-    150..156 'b"foo"': &[u8]
+    131..132 'x': &[u8]
+    141..163 '{     ...(x); }': ()
+    147..157 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8
+    147..160 '<[_]>::foo(x)': u8
+    158..159 'x': &[u8]
     "###
     );
 }
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs
index 3d3088965d..e17a179004 100644
--- a/crates/ra_hir_ty/src/tests/simple.rs
+++ b/crates/ra_hir_ty/src/tests/simple.rs
@@ -414,7 +414,7 @@ fn test() {
     27..31 '5f32': f32
     37..41 '5f64': f64
     47..54 '"hello"': &str
-    60..68 'b"bytes"': &[u8]
+    60..68 'b"bytes"': &[u8; _]
     74..77 ''c'': char
     83..87 'b'b'': u8
     93..97 '3.14': f64
@@ -422,7 +422,7 @@ fn test() {
     113..118 'false': bool
     124..128 'true': bool
     134..202 'r#"   ...    "#': &str
-    208..218 'br#"yolo"#': &[u8]
+    208..218 'br#"yolo"#': &[u8; _]
     "###
     );
 }
Repository: rust-analyzer/rust-analyzer
Pull request #4388 (2020-05-09 12:48:58)

unindent -> dedent


bors r+
🤖


Patch:
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs
index 0f29149507..66b296081d 100644
--- a/crates/ra_assists/src/handlers/early_return.rs
+++ b/crates/ra_assists/src/handlers/early_return.rs
@@ -156,7 +156,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
             parent_block: &ast::BlockExpr,
             if_expr: &ast::IfExpr,
         ) -> SyntaxNode {
-            let then_block_items = then_block.unindent(IndentLevel::from(1));
+            let then_block_items = then_block.dedent(IndentLevel::from(1));
             let end_of_then = then_block_items.syntax().last_child_or_token().unwrap();
             let end_of_then =
                 if end_of_then.prev_sibling_or_token().map(|n| n.kind()) == Some(WHITESPACE) {
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 94dfb1a139..24a1e1d918 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -555,7 +555,7 @@ pub trait AstNodeEdit: AstNode + Clone + Sized {
         Self::cast(indent.increase_indent(self.syntax().clone())).unwrap()
     }
     #[must_use]
-    fn unindent(&self, indent: IndentLevel) -> Self {
+    fn dedent(&self, indent: IndentLevel) -> Self {
         Self::cast(indent.decrease_indent(self.syntax().clone())).unwrap()
     }
 }


Test patch:
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index b13e13af2a..b1e3c328f3 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -270,7 +270,7 @@ fn parse_fixture_checks_further_indented_metadata() {
 }
 
 #[test]
-fn parse_fixture_can_handle_unindented_first_line() {
+fn parse_fixture_can_handle_dedented_first_line() {
     let fixture = "//- /lib.rs
                    mod foo;
                    //- /foo.rs
Repository: rust-analyzer/rust-analyzer
Pull request #5326 (2020-07-11 22:44:37)

infer: Add type inference support for Union types
This adds the type inference to Union types and add a small test case
for it, ensuring it keeps working in future.

Fixes: #5277
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>


----

#


Patch:
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 06baac2a9b..bd9a387f58 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -405,8 +405,15 @@ impl<'a> InferenceContext<'a> {
                                     .subst(&a_ty.parameters)
                             })
                         }
-                        // FIXME:
-                        TypeCtor::Adt(AdtId::UnionId(_)) => None,
+                        TypeCtor::Adt(AdtId::UnionId(u)) => {
+                            self.db.union_data(u).variant_data.field(name).map(|local_id| {
+                                let field = FieldId { parent: u.into(), local_id };
+                                self.write_field_resolution(tgt_expr, field);
+                                self.db.field_types(u.into())[field.local_id]
+                                    .clone()
+                                    .subst(&a_ty.parameters)
+                            })
+                        }
                         _ => None,
                     },
                     _ => None,


Test patch:
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs
index de63f4ccea..6d3e264af3 100644
--- a/crates/ra_hir_ty/src/tests/simple.rs
+++ b/crates/ra_hir_ty/src/tests/simple.rs
@@ -324,6 +324,29 @@ fn test() {
     );
 }
 
+#[test]
+fn infer_union() {
+    assert_snapshot!(
+        infer(r#"
+union MyUnion {
+    foo: u32,
+    bar: f32,
+}
+
+unsafe fn baz(u: MyUnion) {
+    let inner = u.foo;
+}
+"#),
+        @r###"
+    61..62 'u': MyUnion
+    73..99 '{     ...foo; }': ()
+    83..88 'inner': u32
+    91..92 'u': MyUnion
+    91..96 'u.foo': u32
+    "###
+    );
+}
+
 #[test]
 fn infer_refs() {
     assert_snapshot!(
Repository: rust-analyzer/rust-analyzer
Pull request #5376 (2020-07-14 15:14:14)

Check licenses


bors r+
🤖


Patch:
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs
index 747654c1fc..94d451e231 100644
--- a/xtask/src/lib.rs
+++ b/xtask/src/lib.rs
@@ -20,7 +20,7 @@ use walkdir::{DirEntry, WalkDir};
 
 use crate::{
     codegen::Mode,
-    not_bash::{fs2, pushd, pushenv, rm_rf, run},
+    not_bash::{fs2, pushd, pushenv, rm_rf},
 };
 
 pub use anyhow::{bail, Context as _, Result};
diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs
index 8844fa2168..0f3a56b25f 100644
--- a/xtask/src/not_bash.rs
+++ b/xtask/src/not_bash.rs
@@ -54,7 +54,8 @@ pub mod fs2 {
     }
 }
 
-macro_rules! _run {
+#[macro_export]
+macro_rules! run {
     ($($expr:expr),*) => {
         run!($($expr),*; echo = true)
     };
@@ -65,7 +66,7 @@ macro_rules! _run {
         $crate::not_bash::run_process(format!($($expr),*), false, Some($stdin))
     };
 }
-pub(crate) use _run as run;
+pub use crate::run;
 
 pub struct Pushd {
     _p: (),


Test patch:
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index fcfad609d7..72088e4148 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -5,7 +5,7 @@ use std::{
 
 use xtask::{
     codegen::{self, Mode},
-    not_bash::fs2,
+    not_bash::{fs2, run},
     project_root, run_rustfmt, rust_files,
 };
 
@@ -49,6 +49,45 @@ fn rust_files_are_tidy() {
     tidy_docs.finish();
 }
 
+#[test]
+fn check_licenses() {
+    let expected = "
+0BSD OR MIT OR Apache-2.0
+Apache-2.0
+Apache-2.0 / MIT
+Apache-2.0 OR BSL-1.0
+Apache-2.0 OR MIT
+Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
+Apache-2.0/MIT
+BSD-2-Clause
+BSD-3-Clause
+CC0-1.0
+ISC
+MIT
+MIT / Apache-2.0
+MIT OR Apache-2.0
+MIT/Apache-2.0
+MIT/Apache-2.0 AND BSD-2-Clause
+Unlicense OR MIT
+Unlicense/MIT
+Zlib
+"
+    .lines()
+    .filter(|it| !it.is_empty())
+    .collect::<Vec<_>>();
+
+    let meta = run!("cargo metadata --format-version 1"; echo = false).unwrap();
+    let mut licenses = meta
+        .split(|c| c == ',' || c == '{' || c == '}')
+        .filter(|it| it.contains(r#""license""#))
+        .map(|it| it.trim())
+        .map(|it| it[r#""license":"#.len()..].trim_matches('"'))
+        .collect::<Vec<_>>();
+    licenses.sort();
+    licenses.dedup();
+    assert_eq!(licenses, expected);
+}
+
 fn check_todo(path: &Path, text: &str) {
     let need_todo = &[
         // This file itself obviously needs to use todo (<- like this!).
Repository: rust-analyzer/rust-analyzer
Pull request #5456 (2020-07-20 15:45:22)

Simplify


bors r+
🤖


Patch:
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index b279bdeef6..5a9de3d3ec 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -229,12 +229,11 @@ impl CrateDefMap {
     // even), as this should be a great debugging aid.
     pub fn dump(&self) -> String {
         let mut buf = String::new();
-        go(&mut buf, self, "\ncrate", self.root);
-        return buf.trim().to_string();
+        go(&mut buf, self, "crate", self.root);
+        return buf;
 
         fn go(buf: &mut String, map: &CrateDefMap, path: &str, module: LocalModuleId) {
-            *buf += path;
-            *buf += "\n";
+            format_to!(buf, "{}\n", path);
 
             let mut entries: Vec<_> = map.modules[module].scope.resolutions().collect();
             entries.sort_by_key(|(name, _)| name.clone());
@@ -243,23 +242,24 @@ impl CrateDefMap {
                 format_to!(buf, "{}:", name);
 
                 if def.types.is_some() {
-                    *buf += " t";
+                    buf.push_str(" t");
                 }
                 if def.values.is_some() {
-                    *buf += " v";
+                    buf.push_str(" v");
                 }
                 if def.macros.is_some() {
-                    *buf += " m";
+                    buf.push_str(" m");
                 }
                 if def.is_none() {
-                    *buf += " _";
+                    buf.push_str(" _");
                 }
 
-                *buf += "\n";
+                buf.push_str("\n");
             }
 
             for (name, child) in map.modules[module].children.iter() {
-                let path = &format!("{}::{}", path, name);
+                let path = format!("{}::{}", path, name);
+                buf.push('\n');
                 go(buf, map, &path, *child);
             }
         }


Test patch:
diff --git a/crates/ra_hir_def/src/nameres/tests.rs b/crates/ra_hir_def/src/nameres/tests.rs
index 02dca80c25..205d3528be 100644
--- a/crates/ra_hir_def/src/nameres/tests.rs
+++ b/crates/ra_hir_def/src/nameres/tests.rs
@@ -21,7 +21,7 @@ fn compute_crate_def_map(fixture: &str) -> Arc<CrateDefMap> {
 fn check(ra_fixture: &str, expect: Expect) {
     let db = TestDB::with_files(ra_fixture);
     let krate = db.crate_graph().iter().next().unwrap();
-    let actual = db.crate_def_map(krate).dump() + "\n";
+    let actual = db.crate_def_map(krate).dump();
     expect.assert_eq(&actual);
 }
Repository: rust-analyzer/rust-analyzer
Pull request #5066 (2020-06-25 21:22:08)

Infer type for slice wildcard patterns
Resolves https://github.com/rust-analyzer/rust-analyzer/issues/4830

The issue is just that we were never inferring the type for the wildcard `..` in slice patterns.


Patch:
diff --git a/crates/ra_hir_ty/src/infer/pat.rs b/crates/ra_hir_ty/src/infer/pat.rs
index 23de2bd6b0..4dd4f9802d 100644
--- a/crates/ra_hir_ty/src/infer/pat.rs
+++ b/crates/ra_hir_ty/src/infer/pat.rs
@@ -184,7 +184,7 @@ impl<'a> InferenceContext<'a> {
                 self.write_pat_ty(pat, bound_ty);
                 return inner_ty;
             }
-            Pat::Slice { prefix, slice: _slice, suffix } => {
+            Pat::Slice { prefix, slice, suffix } => {
                 let (container_ty, elem_ty) = match &expected {
                     ty_app!(TypeCtor::Array, st) => (TypeCtor::Array, st.as_single().clone()),
                     ty_app!(TypeCtor::Slice, st) => (TypeCtor::Slice, st.as_single().clone()),
@@ -195,7 +195,12 @@ impl<'a> InferenceContext<'a> {
                     self.infer_pat(*pat_id, &elem_ty, default_bm);
                 }
 
-                Ty::apply_one(container_ty, elem_ty)
+                let pat_ty = Ty::apply_one(container_ty, elem_ty);
+                if let Some(slice_pat_id) = slice {
+                    self.infer_pat(*slice_pat_id, &pat_ty, default_bm);
+                }
+
+                pat_ty
             }
             Pat::Wild => expected.clone(),
             Pat::Range { start, end } => {


Test patch:
diff --git a/crates/ra_hir_ty/src/tests/patterns.rs b/crates/ra_hir_ty/src/tests/patterns.rs
index e5ef241cae..f937426bdb 100644
--- a/crates/ra_hir_ty/src/tests/patterns.rs
+++ b/crates/ra_hir_ty/src/tests/patterns.rs
@@ -627,3 +627,28 @@ fn test() {
     "###
     );
 }
+
+#[test]
+fn slice_tail_pattern() {
+    assert_snapshot!(
+        infer(r#"
+fn foo(params: &[i32]) {
+    match params {
+        [head, tail @ ..] => {
+        }
+    }
+}
+"#),
+        @r###"
+    7..13 'params': &[i32]
+    23..92 '{     ...   } }': ()
+    29..90 'match ...     }': ()
+    35..41 'params': &[i32]
+    52..69 '[head,... @ ..]': [i32]
+    53..57 'head': &i32
+    59..68 'tail @ ..': &[i32]
+    66..68 '..': [i32]
+    73..84 '{         }': ()
+    "###
+    );
+}
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs
index eedaa27bad..aa37326dff 100644
--- a/crates/ra_hir_ty/src/tests/regression.rs
+++ b/crates/ra_hir_ty/src/tests/regression.rs
@@ -500,6 +500,8 @@ fn foo(params: &[usize]) {
     31..78 'match ...     }': ()
     37..43 'params': &[usize]
     54..66 '[ps @ .., _]': [usize]
+    55..62 'ps @ ..': &[usize]
+    60..62 '..': [usize]
     64..65 '_': usize
     70..72 '{}': ()
     "###
Repository: rust-analyzer/rust-analyzer
Pull request #5179 (2020-07-01 17:23:50)

ItemTree: Lower fields despite invalid type
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5147

bors r+


Patch:
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index 5149dd141f..06743d7fce 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -211,7 +211,7 @@ impl Ctx {
     fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> {
         let name = field.name()?.as_name();
         let visibility = self.lower_visibility(field);
-        let type_ref = self.lower_type_ref(&field.ascribed_type()?);
+        let type_ref = self.lower_type_ref_opt(field.ascribed_type());
         let res = Field { name, type_ref, visibility };
         Some(res)
     }


Test patch:
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index 9084c3bed2..eeac34d140 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -507,6 +507,30 @@ fn no_such_field_with_feature_flag_diagnostics_on_struct_fields() {
     assert_snapshot!(diagnostics, @r###""###);
 }
 
+#[test]
+fn no_such_field_with_type_macro() {
+    let diagnostics = TestDB::with_files(
+        r"
+        macro_rules! Type {
+            () => { u32 };
+        }
+
+        struct Foo {
+            bar: Type![],
+        }
+        impl Foo {
+            fn new() -> Self {
+                Foo { bar: 0 }
+            }
+        }
+        ",
+    )
+    .diagnostics()
+    .0;
+
+    assert_snapshot!(diagnostics, @r###""###);
+}
+
 #[test]
 fn missing_record_pat_field_diagnostic() {
     let diagnostics = TestDB::with_files(
Repository: rust-analyzer/rust-analyzer
Pull request #6017 (2020-09-16 17:14:23)

Don't return any TextEdit if formatting is unchanged
I found that `textDocument/formatting` was always returning a full
`TextEdit` replacement, even when there are no changes, which caused Vim
(w/ vim-lsp) to always indicate a modified buffer after formatting. We
can easily compare whether there were changes and return `null` if not,
so the client knows there's nothing to do.


Patch:
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 64cb4d96cb..c0943a54dc 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -748,10 +748,15 @@ pub(crate) fn handle_formatting(
         }
     }
 
-    Ok(Some(vec![lsp_types::TextEdit {
-        range: Range::new(Position::new(0, 0), end_position),
-        new_text: captured_stdout,
-    }]))
+    if *file == captured_stdout {
+        // The document is already formatted correctly -- no edits needed.
+        Ok(None)
+    } else {
+        Ok(Some(vec![lsp_types::TextEdit {
+            range: Range::new(Position::new(0, 0), end_position),
+            new_text: captured_stdout,
+        }]))
+    }
 }
 
 fn handle_fixes(


Test patch:
diff --git a/crates/rust-analyzer/tests/rust-analyzer/main.rs b/crates/rust-analyzer/tests/rust-analyzer/main.rs
index 0880d04253..06726f9576 100644
--- a/crates/rust-analyzer/tests/rust-analyzer/main.rs
+++ b/crates/rust-analyzer/tests/rust-analyzer/main.rs
@@ -259,6 +259,42 @@ pub use std::collections::HashMap;
     );
 }
 
+#[test]
+fn test_format_document_unchanged() {
+    if skip_slow_tests() {
+        return;
+    }
+
+    let server = project(
+        r#"
+//- /Cargo.toml
+[package]
+name = "foo"
+version = "0.0.0"
+
+//- /src/lib.rs
+fn main() {}
+"#,
+    )
+    .wait_until_workspace_is_loaded();
+
+    server.request::<Formatting>(
+        DocumentFormattingParams {
+            text_document: server.doc_id("src/lib.rs"),
+            options: FormattingOptions {
+                tab_size: 4,
+                insert_spaces: false,
+                insert_final_newline: None,
+                trim_final_newlines: None,
+                trim_trailing_whitespace: None,
+                properties: HashMap::new(),
+            },
+            work_done_progress_params: WorkDoneProgressParams::default(),
+        },
+        json!(null),
+    );
+}
+
 #[test]
 fn test_missing_module_code_action() {
     if skip_slow_tests() {
Repository: rust-analyzer/rust-analyzer
Pull request #6143 (2020-10-05 21:41:44)

Account for proc macro helpers when parsing attr
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6138


Patch:
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index 100e25ffcf..c8cd042644 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -1229,9 +1229,10 @@ impl ModCollector<'_, '_> {
         } else {
             let derive = attrs.by_key("proc_macro_derive");
             if let Some(arg) = derive.tt_values().next() {
-                if let [TokenTree::Leaf(Leaf::Ident(trait_name))] = &*arg.token_trees {
+                if let [TokenTree::Leaf(Leaf::Ident(trait_name)), ..] = &*arg.token_trees {
                     trait_name.as_name()
                 } else {
+                    log::trace!("malformed `#[proc_macro_derive]`: {}", arg);
                     return;
                 }
             } else {


Test patch:
diff --git a/crates/hir_def/src/nameres/tests/macros.rs b/crates/hir_def/src/nameres/tests/macros.rs
index 0851c3b7d8..305fca0f9c 100644
--- a/crates/hir_def/src/nameres/tests/macros.rs
+++ b/crates/hir_def/src/nameres/tests/macros.rs
@@ -688,13 +688,20 @@ fn resolves_proc_macros() {
         pub fn derive_macro(_item: TokenStream) -> TokenStream {
             TokenStream
         }
+
+        #[proc_macro_derive(AnotherTrait, attributes(helper_attr))]
+        pub fn derive_macro_2(_item: TokenStream) -> TokenStream {
+            TokenStream
+        }
         ",
         expect![[r#"
             crate
+            AnotherTrait: m
             DummyTrait: m
             TokenStream: t v
             attribute_macro: v m
             derive_macro: v
+            derive_macro_2: v
             function_like_macro: v m
         "#]],
     );
Repository: rust-analyzer/rust-analyzer
Pull request #5719 (2020-08-12 11:03:51)

Minor


bors r+
🤖


Patch:
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index d3d62debfd..d0cb62ef01 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -265,7 +265,8 @@ impl SourceAnalyzer {
         }
 
         // This must be a normal source file rather than macro file.
-        let hir_path = Path::from_src(path.clone(), &Hygiene::new(db.upcast(), self.file_id))?;
+        let hir_path =
+            crate::Path::from_src(path.clone(), &Hygiene::new(db.upcast(), self.file_id))?;
 
         // Case where path is a qualifier of another path, e.g. foo::bar::Baz where we
         // trying to resolve foo::bar.
@@ -450,7 +451,7 @@ fn adjust(
 pub(crate) fn resolve_hir_path(
     db: &dyn HirDatabase,
     resolver: &Resolver,
-    path: &Path,
+    path: &crate::Path,
 ) -> Option<PathResolution> {
     let types =
         resolver.resolve_path_in_type_ns_fully(db.upcast(), path.mod_path()).map(|ty| match ty {
@@ -511,7 +512,7 @@ pub(crate) fn resolve_hir_path(
 pub(crate) fn resolve_hir_path_qualifier(
     db: &dyn HirDatabase,
     resolver: &Resolver,
-    path: &Path,
+    path: &crate::Path,
 ) -> Option<PathResolution> {
     let items = resolver
         .resolve_module_path_in_items(db.upcast(), path.mod_path())


Test patch:
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index ca23010213..4ff72865e8 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -56,6 +56,7 @@ fn deny_clippy(path: &PathBuf, text: &String) {
             "\n\nallowing lints is forbidden: {}.
 rust-analyzer intentionally doesn't check clippy on CI.
 You can allow lint globally via `xtask clippy`.
+See https://github.com/rust-lang/rust-clippy/issues/5537 for discussion.
 
 ",
             path.display()