From 9d3e0824a0966c648e951e5928c241700ee931fb Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Wed, 31 Mar 2021 13:19:55 -0600 Subject: "im not owned! im not owned!!", i continue to insist as i allocate and transform into a String https://twitter.com/dril_rs/status/1035032121860009984 --- src/main.rs | 4 ++-- src/makefile/functions.rs | 4 ++-- src/makefile/mod.rs | 4 ++-- src/makefile/pattern.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index f96d39c..191f4fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,11 +45,11 @@ fn main() -> anyhow::Result<()> { bail!( "no makefile specified and neither {} nor {} was found.", current_dir().map_or_else( - |_| "./makefile".to_string(), + |_| "./makefile".to_owned(), |path| path.join("makefile").display().to_string() ), current_dir().map_or_else( - |_| "./Makefile".to_string(), + |_| "./Makefile".to_owned(), |path| path.join("Makefile").display().to_string() ), ); diff --git a/src/makefile/functions.rs b/src/makefile/functions.rs index b4687c3..880ee7f 100644 --- a/src/makefile/functions.rs +++ b/src/makefile/functions.rs @@ -341,7 +341,7 @@ mod test { fn foreach() -> R { let mut macros = MacroSet::new(); macros.set( - "test".to_string(), + "test".to_owned(), MacroSource::File, "worked for $(item).".parse().unwrap(), ); @@ -364,7 +364,7 @@ mod test { fn call_test() -> R { let mut macros = MacroSet::new(); macros.set( - "reverse".to_string(), + "reverse".to_owned(), MacroSource::File, "$(2) $(1)".parse().unwrap(), ); diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index 582c62d..270dd46 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -303,8 +303,8 @@ impl<'a> Makefile<'a> { if let Some(inference_match) = inference_match { let new_rule = InferenceRule { - product: inference_match.name("s1").unwrap().as_str().to_string(), - prereq: inference_match.name("s2").unwrap().as_str().to_string(), + product: inference_match.name("s1").unwrap().as_str().to_owned(), + prereq: inference_match.name("s2").unwrap().as_str().to_owned(), commands, }; diff --git a/src/makefile/pattern.rs b/src/makefile/pattern.rs index fbd89a5..e4077cd 100644 --- a/src/makefile/pattern.rs +++ b/src/makefile/pattern.rs @@ -7,11 +7,11 @@ fn compile_pattern(pattern: &str) -> anyhow::Result { if let Some(real_result) = result.strip_suffix(r"\\\\") { // We end with two backslashes, so this is an escaped backslash and then an // unescaped wildcard. - result = real_result.to_string(); + result = real_result.to_owned(); result.push_str(r"\\(\w*)"); } else if let Some(real_result) = result.strip_suffix(r"\\") { // We end with one backslash, so this is an escaped wildcard. - result = real_result.to_string(); + result = real_result.to_owned(); result.push('%'); } else { // We don't end with a backslash, so this is an unescaped wildcard. -- cgit v1.2.3