(&self)
| 155 | |
| 156 | impl CargoPathExt for Path { |
| 157 | fn rm_rf(&self) { |
| 158 | let meta = match self.symlink_metadata() { |
| 159 | Ok(meta) => meta, |
| 160 | Err(e) => { |
| 161 | if e.kind() == ErrorKind::NotFound { |
| 162 | return; |
| 163 | } |
| 164 | panic!("failed to remove {self:?}, could not read: {e:?}"); |
| 165 | } |
| 166 | }; |
| 167 | // There is a race condition between fetching the metadata and |
| 168 | // actually performing the removal, but we don't care all that much |
| 169 | // for our tests. |
| 170 | if meta.is_dir() { |
| 171 | if let Err(e) = fs::remove_dir_all(self) { |
| 172 | panic!("failed to remove {self:?}: {e:?}") |
| 173 | } |
| 174 | } else if let Err(e) = fs::remove_file(self) { |
| 175 | panic!("failed to remove {self:?}: {e:?}") |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | fn mkdir_p(&self) { |
| 180 | fs::create_dir_all(self) |
no outgoing calls
no test coverage detected