Parcourir la source

use line!, col!, and row! instead of panic location

Evan Almloff il y a 3 ans
Parent
commit
7025bd43aa
2 fichiers modifiés avec 2 ajouts et 5 suppressions
  1. 1 1
      src/server/hot_reload.rs
  2. 1 4
      src/server/mod.rs

+ 1 - 1
src/server/hot_reload.rs

@@ -97,7 +97,7 @@ pub async fn hot_reload_handler(
                             if let DiffResult::RsxChanged(changed) = find_rsx(&new_file, &old_file) {
                                 for (old, new) in changed.into_iter() {
                                     let hr = get_location(
-                                        k.strip_prefix(&state.watcher_config.crate_dir).unwrap(),
+                                        k,
                                         old.to_token_stream(),
                                     );
                                     // get the original source code to preserve whitespace

+ 1 - 4
src/server/mod.rs

@@ -121,10 +121,7 @@ pub async fn startup_hot_reload(config: CrateConfig) -> Result<()> {
                                         log::info!("reloading rsx");
                                         for (old, new) in changed.into_iter() {
                                             let hr = get_location(
-                                                &path
-                                                    .strip_prefix(&crate_dir)
-                                                    .unwrap()
-                                                    .to_path_buf(),
+                                                &path.to_path_buf(),
                                                 old.to_token_stream(),
                                             );
                                             // get the original source code to preserve whitespace