aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/diagnostics.rs6
-rw-r--r--crates/ide/src/diagnostics/fixes.rs3
2 files changed, 4 insertions, 5 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index add102ff2..b30cdb6ed 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -257,8 +257,7 @@ mod tests {
257 257
258 assert_eq_text!(&after, &actual); 258 assert_eq_text!(&after, &actual);
259 assert!( 259 assert!(
260 fix.fix_trigger_range.start() <= file_position.offset 260 fix.fix_trigger_range.contains_inclusive(file_position.offset),
261 && fix.fix_trigger_range.end() >= file_position.offset,
262 "diagnostic fix range {:?} does not touch cursor position {:?}", 261 "diagnostic fix range {:?} does not touch cursor position {:?}",
263 fix.fix_trigger_range, 262 fix.fix_trigger_range,
264 file_position.offset 263 file_position.offset
@@ -288,8 +287,7 @@ mod tests {
288 287
289 assert_eq_text!(&after, &actual); 288 assert_eq_text!(&after, &actual);
290 assert!( 289 assert!(
291 fix.fix_trigger_range.start() <= file_position.offset 290 fix.fix_trigger_range.contains_inclusive(file_position.offset),
292 && fix.fix_trigger_range.end() >= file_position.offset,
293 "diagnostic fix range {:?} does not touch cursor position {:?}", 291 "diagnostic fix range {:?} does not touch cursor position {:?}",
294 fix.fix_trigger_range, 292 fix.fix_trigger_range,
295 file_position.offset 293 file_position.offset
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index b47fe0469..0c75e50b0 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -111,7 +111,8 @@ impl DiagnosticWithFix for IncorrectCase {
111 let offset = name_node.syntax().text_range().start(); 111 let offset = name_node.syntax().text_range().start();
112 let file_position = FilePosition { file_id, offset }; 112 let file_position = FilePosition { file_id, offset };
113 113
114 let rename_changes = rename_with_semantics(sema, file_position, &self.suggested_text)?; 114 let rename_changes =
115 rename_with_semantics(sema, file_position, &self.suggested_text).ok()?;
115 116
116 let label = format!("Rename to {}", self.suggested_text); 117 let label = format!("Rename to {}", self.suggested_text);
117 Some(Fix::new(&label, rename_changes.info, rename_changes.range)) 118 Some(Fix::new(&label, rename_changes.info, rename_changes.range))