about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNick Cameron <nrc@ncameron.org>2015-05-02 06:59:00 +1200
committerNick Cameron <nrc@ncameron.org>2015-05-02 06:59:00 +1200
commit3149eff2236bdbddeaede499d7a6617547840eb6 (patch)
treed4f77e731f4bd3e91d40f4ecf4b88db451f13fbb /src
parent2b73dcd6620dad627df1175e5b4005078e953106 (diff)
parentc006b84d878039f35455a79618bac4a768034cca (diff)
Merge pull request #58 from Stebalien/borrow
Trust the borrow checker.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 8cd95ddf626..e16537198f6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -153,7 +153,7 @@ fn fmt_lines(changes: &mut ChangeSet) {
 
         if newline_count > 1 {
             debug!("track truncate: {} {} {}", f, text.len, newline_count);
-            truncate_todo.push((f, text.len - newline_count + 1))
+            truncate_todo.push((f.to_string(), text.len - newline_count + 1))
         }
 
         for &(l, _, _) in trims.iter() {
@@ -163,12 +163,7 @@ fn fmt_lines(changes: &mut ChangeSet) {
     }
 
     for (f, l) in truncate_todo {
-        // This unsafe block and the ridiculous dance with the cast is because
-        // the borrow checker thinks the first borrow of changes lasts for the
-        // whole function.
-        unsafe {
-            (*(changes as *const ChangeSet as *mut ChangeSet)).get_mut(f).truncate(l);
-        }
+        changes.get_mut(&f).truncate(l);
     }
 }