MCPcopy Index your code
hub / github.com/cargo-lambda/cargo-lambda / rm_rf

Method rm_rf

crates/cargo-lambda-cli/tests/harness/project.rs:157–177  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

155
156impl 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)

Callers 3

test_build_exampleFunction · 0.80
rm_rootMethod · 0.80
init_rootFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected