Try to get rid of owned types

Inspired by https://www.youtube.com/watch?v=A4cKi7PTJSs. This turns a
lot of cloning Strings and PathBufs into Rcs.
This commit is contained in:
Adrian Heine 2023-06-17 14:53:38 +02:00
parent e3b425eb1c
commit d091265d27
20 changed files with 343 additions and 232 deletions

View file

@ -9,6 +9,7 @@ use schematics::SymbolRunner;
use slog::{info, Logger as SlogLogger};
use std::error::Error;
use std::fmt::Debug;
use std::path::Path;
use std::time::Duration;
#[derive(Clone, Debug)]
@ -60,7 +61,7 @@ fn test(
#[test]
fn can_create_an_acme_user() {
let mut result = test(1, |setup| {
assert_eq!((run(setup.add(AcmeUser)).unwrap().0).0, "acme");
assert_eq!(&*(run(setup.add(AcmeUser)).unwrap().0).0, "acme");
});
let entry = result
.pop()
@ -133,8 +134,8 @@ fn can_create_an_acme_cert() {
#[test]
fn can_create_a_git_checkout() {
let mut result = test(1, |setup| {
run(setup.add(GitCheckout(
"/tmp/somepath".into(),
run(setup.add(GitCheckout::new(
"/tmp/somepath".as_ref() as &Path,
"/tmp/some_src_repo",
"master",
)))