diff options
author | Emil Lauridsen <[email protected]> | 2020-03-12 14:01:53 +0000 |
---|---|---|
committer | Emil Lauridsen <[email protected]> | 2020-03-12 14:01:53 +0000 |
commit | 637c795b3c9a56795977ade0cedbc7a9fb7dc453 (patch) | |
tree | c88f77b45c2a5f24b31f1b7ed10956619438989f /crates/ra_cargo_watch/src/conv/snapshots | |
parent | 05b4fc6d79060fc3120f92b01119e3a851c37829 (diff) |
Correctly handle multi-line fixes from cargo/clippy
Diffstat (limited to 'crates/ra_cargo_watch/src/conv/snapshots')
3 files changed, 114 insertions, 2 deletions
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap index 95ca163dc..47801ae79 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_clippy_pass_by_ref.snap | |||
@@ -63,7 +63,7 @@ MappedRustDiagnostic { | |||
63 | }, | 63 | }, |
64 | fixes: [ | 64 | fixes: [ |
65 | CodeAction { | 65 | CodeAction { |
66 | title: "consider passing by value instead: \'self\'", | 66 | title: "consider passing by value instead", |
67 | kind: Some( | 67 | kind: Some( |
68 | "quickfix", | 68 | "quickfix", |
69 | ), | 69 | ), |
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_multi_line_fix.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_multi_line_fix.snap new file mode 100644 index 000000000..23c4f5a2c --- /dev/null +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_multi_line_fix.snap | |||
@@ -0,0 +1,112 @@ | |||
1 | --- | ||
2 | source: crates/ra_cargo_watch/src/conv/test.rs | ||
3 | expression: diag | ||
4 | --- | ||
5 | MappedRustDiagnostic { | ||
6 | location: Location { | ||
7 | uri: "file:///test/src/main.rs", | ||
8 | range: Range { | ||
9 | start: Position { | ||
10 | line: 3, | ||
11 | character: 4, | ||
12 | }, | ||
13 | end: Position { | ||
14 | line: 3, | ||
15 | character: 5, | ||
16 | }, | ||
17 | }, | ||
18 | }, | ||
19 | diagnostic: Diagnostic { | ||
20 | range: Range { | ||
21 | start: Position { | ||
22 | line: 3, | ||
23 | character: 4, | ||
24 | }, | ||
25 | end: Position { | ||
26 | line: 3, | ||
27 | character: 5, | ||
28 | }, | ||
29 | }, | ||
30 | severity: Some( | ||
31 | Warning, | ||
32 | ), | ||
33 | code: Some( | ||
34 | String( | ||
35 | "let_and_return", | ||
36 | ), | ||
37 | ), | ||
38 | source: Some( | ||
39 | "clippy", | ||
40 | ), | ||
41 | message: "returning the result of a let binding from a block\n`#[warn(clippy::let_and_return)]` on by default\nfor further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return", | ||
42 | related_information: Some( | ||
43 | [ | ||
44 | DiagnosticRelatedInformation { | ||
45 | location: Location { | ||
46 | uri: "file:///test/src/main.rs", | ||
47 | range: Range { | ||
48 | start: Position { | ||
49 | line: 2, | ||
50 | character: 4, | ||
51 | }, | ||
52 | end: Position { | ||
53 | line: 2, | ||
54 | character: 30, | ||
55 | }, | ||
56 | }, | ||
57 | }, | ||
58 | message: "unnecessary let binding", | ||
59 | }, | ||
60 | ], | ||
61 | ), | ||
62 | tags: None, | ||
63 | }, | ||
64 | fixes: [ | ||
65 | CodeAction { | ||
66 | title: "return the expression directly", | ||
67 | kind: Some( | ||
68 | "quickfix", | ||
69 | ), | ||
70 | diagnostics: None, | ||
71 | edit: Some( | ||
72 | WorkspaceEdit { | ||
73 | changes: Some( | ||
74 | { | ||
75 | "file:///test/src/main.rs": [ | ||
76 | TextEdit { | ||
77 | range: Range { | ||
78 | start: Position { | ||
79 | line: 2, | ||
80 | character: 4, | ||
81 | }, | ||
82 | end: Position { | ||
83 | line: 2, | ||
84 | character: 30, | ||
85 | }, | ||
86 | }, | ||
87 | new_text: "", | ||
88 | }, | ||
89 | TextEdit { | ||
90 | range: Range { | ||
91 | start: Position { | ||
92 | line: 3, | ||
93 | character: 4, | ||
94 | }, | ||
95 | end: Position { | ||
96 | line: 3, | ||
97 | character: 5, | ||
98 | }, | ||
99 | }, | ||
100 | new_text: "(0..10).collect()", | ||
101 | }, | ||
102 | ], | ||
103 | }, | ||
104 | ), | ||
105 | document_changes: None, | ||
106 | }, | ||
107 | ), | ||
108 | command: None, | ||
109 | is_preferred: None, | ||
110 | }, | ||
111 | ], | ||
112 | } | ||
diff --git a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap index 3e1fe736c..8bab09540 100644 --- a/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap +++ b/crates/ra_cargo_watch/src/conv/snapshots/ra_cargo_watch__conv__test__snap_rustc_unused_variable.snap | |||
@@ -48,7 +48,7 @@ MappedRustDiagnostic { | |||
48 | }, | 48 | }, |
49 | fixes: [ | 49 | fixes: [ |
50 | CodeAction { | 50 | CodeAction { |
51 | title: "consider prefixing with an underscore: \'_foo\'", | 51 | title: "consider prefixing with an underscore", |
52 | kind: Some( | 52 | kind: Some( |
53 | "quickfix", | 53 | "quickfix", |
54 | ), | 54 | ), |