Skip to content

Commit

Permalink
refactor: make using simdutf8 more apparent by using it fully qualifi…
Browse files Browse the repository at this point in the history
…ed call inline
  • Loading branch information
jqnatividad committed Nov 3, 2024
1 parent 8f50f45 commit 55ede2e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cmd/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ use reqwest::{
};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use simdutf8::basic::from_utf8;
use simple_expand_tilde::expand_tilde;
use url::Url;

Expand Down Expand Up @@ -774,14 +773,18 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
// let's dynamically construct the URL with it
record_vec.clear();
for field in &record {
record_vec.push(from_utf8(field).unwrap_or_default().to_owned());
record_vec.push(
simdutf8::basic::from_utf8(field)
.unwrap_or_default()
.to_owned(),
);
}
if let Ok(formatted) =
dynfmt::SimpleCurlyFormat.format(&dynfmt_url_template, &*record_vec)
{
url = formatted.into_owned();
}
} else if let Ok(s) = from_utf8(&record[column_index]) {
} else if let Ok(s) = simdutf8::basic::from_utf8(&record[column_index]) {
// we're not using a URL template,
// just use the field as-is as the URL
s.clone_into(&mut url);
Expand Down

0 comments on commit 55ede2e

Please sign in to comment.