on master help sign in
dap: Simplify more calls
commit5803de2067db228257ac3eb028af1a783d1243fb authorBlaž Hrastnik <blaz@mxxn.io> dateSun 7 Nov 2021, 18:51 (5 years ago) parent155c608
1 file changed+9−7
helix-term/src/commands/dap.rs+9−7
helix-term/src/commands/dap.rs+9−7
@@ -163,7 +163,7 @@ pub fn dap_start_impl(
163163 let (_, doc) = current!(editor);
164164
165165 let path = match doc.path() {
166− Some(path) => path.to_path_buf(),
166+ Some(path) => path,
167167 None => {
168168 editor.set_error("Can't start debug: document has no path".to_string());
169169 return;
@@ -420,7 +420,7 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) {
420420 };
421421
422422 let path = match doc.path() {
423− Some(path) => path.to_path_buf(),
423+ Some(path) => path,
424424 None => {
425425 cx.editor
426426 .set_error("Can't set breakpoint: document has no path".to_string());
@@ -444,7 +444,7 @@ pub fn dap_toggle_breakpoint(cx: &mut Context) {
444444 Some(debugger) => debugger,
445445 None => return,
446446 };
447− let request = debugger.set_breakpoints(path, breakpoints);
447+ let request = debugger.set_breakpoints(path.clone(), breakpoints);
448448 match block_on(request) {
449449 Ok(Some(breakpoints)) => {
450450 let old_breakpoints = debugger.breakpoints.clone();
@@ -671,7 +671,7 @@ pub fn dap_edit_condition(cx: &mut Context) {
671671
672672 let (_, doc) = current!(cx.editor);
673673 let path = match doc.path() {
674− Some(path) => path.to_path_buf(),
674+ Some(path) => path,
675675 None => {
676676 cx.editor.set_status(
677677 "Can't edit breakpoint: document has no path".to_owned(),
@@ -713,7 +713,8 @@ pub fn dap_edit_condition(cx: &mut Context) {
713713 // {
714714 // bail!("Can't edit breakpoint: debugger does not support logpoints")
715715 // }
716− let request = debugger.set_breakpoints(path, breakpoints.clone());
716+ let request =
717+ debugger.set_breakpoints(path.clone(), breakpoints.clone());
717718 if let Err(e) = block_on(request) {
718719 cx.editor
719720 .set_status(format!("Failed to set breakpoints: {:?}", e))
@@ -749,7 +750,7 @@ pub fn dap_edit_log(cx: &mut Context) {
749750
750751 let (_, doc) = current!(cx.editor);
751752 let path = match doc.path() {
752− Some(path) => path.to_path_buf(),
753+ Some(path) => path,
753754 None => {
754755 cx.editor.set_status(
755756 "Can't edit breakpoint: document has no path".to_owned(),
@@ -791,7 +792,8 @@ pub fn dap_edit_log(cx: &mut Context) {
791792 // {
792793 // bail!("Can't edit breakpoint: debugger does not support logpoints")
793794 // }
794− let request = debugger.set_breakpoints(path, breakpoints.clone());
795+ let request =
796+ debugger.set_breakpoints(path.clone(), breakpoints.clone());
795797 if let Err(e) = block_on(request) {
796798 cx.editor
797799 .set_status(format!("Failed to set breakpoints: {:?}", e))