Skip to content

Commit

Permalink
Avoid some unneessary cloning
Browse files Browse the repository at this point in the history
Change-Id: Ifbd5ef80a72fefc6b224a1801a696eb3c2e32371
  • Loading branch information
vmiklos committed Mar 11, 2023
1 parent 354a6ef commit 6cf0114
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/sync_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn our_main(
for path in paths {
let url = format!("{url}{path}");
let dest = ctx.get_abspath(&format!("workdir/refs/{path}"));
dests.push(dest.clone());
dests.push(dest.to_string());
if ctx.get_file_system().path_exists(&dest) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ pub fn our_main(
stream: &mut dyn Write,
ctx: &context::Context,
) -> anyhow::Result<()> {
let yaml_path = argv[1].clone();
let data = ctx.get_file_system().read_to_string(&yaml_path)?;
let yaml_path = &argv[1];
let data = ctx.get_file_system().read_to_string(yaml_path)?;
let mut errors: Vec<String> = Vec::new();

if data.contains('\t') {
Expand Down
12 changes: 6 additions & 6 deletions src/wsgi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1370,16 +1370,16 @@ fn handle_main(
/// Determines the HTML title for a given function and relation name.
fn get_html_title(request_uri: &str) -> String {
let tokens: Vec<String> = request_uri.split('/').map(|i| i.to_string()).collect();
let mut function: String = "".into();
let mut relation_name: String = "".into();
let mut function = "";
let mut relation_name = "";
if tokens.len() > 3 {
function = tokens[2].clone();
relation_name = tokens[3].clone();
function = &tokens[2];
relation_name = &tokens[3];
}
match function.as_str() {
match function {
"missing-housenumbers" => format!(
" - {}",
tr("{0} missing house numbers").replace("{0}", &relation_name)
tr("{0} missing house numbers").replace("{0}", relation_name)
),
"missing-streets" => format!(" - {} {}", relation_name, tr("missing streets")),
"street-housenumbers" => format!(" - {} {}", relation_name, tr("existing house numbers")),
Expand Down
2 changes: 1 addition & 1 deletion src/yattag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Doc {

/// Gets the escaped value.
pub fn get_value(&self) -> String {
self.value.borrow().clone()
self.value.borrow().to_string()
}

/// Appends escaped content to the value.
Expand Down

0 comments on commit 6cf0114

Please sign in to comment.