mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
parent
006fbefddc
commit
456a05ba40
@ -99,7 +99,7 @@ impl Component for AsyncComponent {
|
||||
let joke = self.joke.as_deref().unwrap_or("Loading...");
|
||||
let fun_score = self
|
||||
.fun_score
|
||||
.map(|score| format!("Fun score: {}", score))
|
||||
.map(|score| format!("Fun score: {score}"))
|
||||
.unwrap_or_else(|| "Computing...".to_string());
|
||||
|
||||
html! {
|
||||
|
||||
@ -132,7 +132,7 @@ impl Boid {
|
||||
let Vector2D { x, y } = self.position + offset;
|
||||
|
||||
// Write to string will never fail.
|
||||
let _ = write!(points, "{:.2},{:.2} ", x, y);
|
||||
let _ = write!(points, "{x:.2},{y:.2} ");
|
||||
}
|
||||
|
||||
html! { <polygon {points} fill={color} /> }
|
||||
|
||||
@ -61,7 +61,7 @@ impl Component for Slider {
|
||||
let display_value = if percentage {
|
||||
format!("{:.p$}%", 100.0 * value, p = precision)
|
||||
} else {
|
||||
format!("{:.p$}", value, p = precision)
|
||||
format!("{value:.precision$}")
|
||||
};
|
||||
|
||||
let id = format!("slider-{}", self.id);
|
||||
|
||||
@ -40,7 +40,7 @@ impl Component for Parent {
|
||||
let msg = format!("My children have been clicked {} times", self.total_clicks);
|
||||
|
||||
let last_updated_msg = if let Some(last_updated) = self.last_updated.as_ref() {
|
||||
format!("The last child that was clicked was {}", last_updated)
|
||||
format!("The last child that was clicked was {last_updated}")
|
||||
} else {
|
||||
"No child has been clicked yet".to_string()
|
||||
};
|
||||
|
||||
@ -60,7 +60,7 @@ impl Component for GrandParent {
|
||||
);
|
||||
|
||||
let detail_msg = if let Some(last_clicked) = &self.state.last_clicked {
|
||||
format!("{} was clicked last", last_clicked)
|
||||
format!("{last_clicked} was clicked last")
|
||||
} else {
|
||||
"No one has been clicked yet".to_string()
|
||||
};
|
||||
@ -135,7 +135,7 @@ impl Component for Child {
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
let my_name = ctx.props().name.clone();
|
||||
let name = format!("{}: ", my_name);
|
||||
let name = format!("{my_name}: ");
|
||||
|
||||
// Here we emit the callback to the grandparent component, whenever the button is clicked.
|
||||
let onclick = self.state.child_clicked.reform(move |_| (my_name.clone()));
|
||||
|
||||
@ -135,7 +135,7 @@ fn app() -> Html {
|
||||
}) }
|
||||
</ul>
|
||||
<button class="clear-completed" onclick={onclear_completed}>
|
||||
{ format!("Clear completed ({})", completed) }
|
||||
{ format!("Clear completed ({completed})") }
|
||||
</button>
|
||||
</footer>
|
||||
</section>
|
||||
|
||||
@ -92,7 +92,7 @@ pub fn render_markdown(src: &str) -> Html {
|
||||
Event::Rule => add_child!(VTag::new("hr").into()),
|
||||
Event::SoftBreak => add_child!(VText::new("\n").into()),
|
||||
Event::HardBreak => add_child!(VTag::new("br").into()),
|
||||
_ => println!("Unknown event: {:#?}", ev),
|
||||
_ => println!("Unknown event: {ev:#?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ fn Important() -> Html {
|
||||
fn use_do_bye() -> SuspensionResult<String> {
|
||||
let path = WASM_BINDGEN_SNIPPETS_PATH
|
||||
.get()
|
||||
.map(|path| format!("{}/js/unimp.js", path))
|
||||
.map(|path| format!("{path}/js/unimp.js"))
|
||||
.unwrap();
|
||||
let s = use_future(|| async move {
|
||||
let promise = bindings::import(&path);
|
||||
|
||||
@ -23,7 +23,7 @@ impl PersonInfo {
|
||||
let city = CityName(EN).fake::<String>();
|
||||
let street = StreetName(EN).fake::<String>();
|
||||
|
||||
Rc::from(format!("{} {} St., {}, {}", no, street, city, state).as_str())
|
||||
Rc::from(format!("{no} {street} St., {city}, {state}").as_str())
|
||||
};
|
||||
|
||||
Self {
|
||||
|
||||
@ -34,7 +34,7 @@ impl App {
|
||||
3 => "Good",
|
||||
_ => "Great!",
|
||||
};
|
||||
format!("Complexity = {}", estimate_text)
|
||||
format!("Complexity = {estimate_text}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ async fn main() {
|
||||
let handle_error = |e| async move {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("error occurred: {}", e),
|
||||
format!("error occurred: {e}"),
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
@ -52,12 +52,11 @@ impl Parse for ClassExpr {
|
||||
if classes.len() > 1 {
|
||||
let fix = classes
|
||||
.into_iter()
|
||||
.map(|class| format!("\"{}\"", class))
|
||||
.map(|class| format!("\"{class}\""))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
let msg = format!(
|
||||
"string literals must not contain more than one class (hint: use `{}`)",
|
||||
fix
|
||||
"string literals must not contain more than one class (hint: use `{fix}`)"
|
||||
);
|
||||
|
||||
Err(syn::Error::new(lit_str.span(), msg))
|
||||
|
||||
@ -332,7 +332,7 @@ impl FunctionComponent {
|
||||
let component_name = self.component_name();
|
||||
let (impl_generics, ty_generics, where_clause) = self.generics.split_for_impl();
|
||||
|
||||
let component_name_lit = LitStr::new(&format!("{}<_>", component_name), Span::mixed_site());
|
||||
let component_name_lit = LitStr::new(&format!("{component_name}<_>"), Span::mixed_site());
|
||||
|
||||
quote! {
|
||||
#[automatically_derived]
|
||||
|
||||
@ -45,7 +45,7 @@ impl fmt::Display for HtmlDashedName {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.name)?;
|
||||
for (_, ident) in &self.extended {
|
||||
write!(f, "-{}", ident)?;
|
||||
write!(f, "-{ident}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -59,9 +59,8 @@ impl Parse for HtmlElement {
|
||||
return Err(syn::Error::new_spanned(
|
||||
open.to_spanned(),
|
||||
format!(
|
||||
"the tag `<{}>` is a void element and cannot have children (hint: \
|
||||
rewrite this as `<{0}/>`)",
|
||||
name
|
||||
"the tag `<{name}>` is a void element and cannot have children (hint: \
|
||||
rewrite this as `<{name} />`)",
|
||||
),
|
||||
));
|
||||
}
|
||||
@ -324,10 +323,8 @@ impl ToTokens for HtmlElement {
|
||||
emit_warning!(
|
||||
dashedname.span(),
|
||||
format!(
|
||||
"The tag '{0}' is not matching its normalized form '{1}'. If you want \
|
||||
to keep this form, change this to a dynamic tag `@{{\"{0}\"}}`.",
|
||||
dashedname,
|
||||
name,
|
||||
"The tag '{dashedname}' is not matching its normalized form '{name}'. If you want \
|
||||
to keep this form, change this to a dynamic tag `@{{\"{dashedname}\"}}`."
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -67,11 +67,11 @@ impl Lint for AHrefLint {
|
||||
match href_value.as_ref() {
|
||||
"#" | "javascript:void(0)" => emit_warning!(
|
||||
lit.span(),
|
||||
format!("'{}' is not a suitable value for the `href` attribute. \
|
||||
format!("'{href_value}' is not a suitable value for the `href` attribute. \
|
||||
Without a meaningful attribute assistive technologies \
|
||||
will struggle to understand your webpage. \
|
||||
https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML#onclick_events"
|
||||
,href_value)),
|
||||
)),
|
||||
_ => {}
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ use syn::Token;
|
||||
/// The implementation is really silly but I couldn't find another way to do it on stable.
|
||||
/// This check isn't required to be fully accurate so it's not the end of the world if it breaks.
|
||||
fn span_eq_hack(a: &Span, b: &Span) -> bool {
|
||||
format!("{:?}", a) == format!("{:?}", b)
|
||||
format!("{a:?}") == format!("{b:?}")
|
||||
}
|
||||
|
||||
/// Change all occurrences of span `from` to `to` in the given error.
|
||||
|
||||
@ -88,9 +88,8 @@ impl Prop {
|
||||
syn::Error::new_spanned(
|
||||
&label,
|
||||
format!(
|
||||
"`{}` doesn't have a value. (hint: set the value to `true` or `false` for \
|
||||
boolean attributes)",
|
||||
label
|
||||
"`{label}` doesn't have a value. (hint: set the value to `true` or `false` \
|
||||
for boolean attributes)"
|
||||
),
|
||||
)
|
||||
})?;
|
||||
@ -132,8 +131,7 @@ fn parse_prop_value(input: &ParseBuffer) -> syn::Result<Expr> {
|
||||
&expr,
|
||||
format!(
|
||||
"the property value must be either a literal or enclosed in braces. Consider \
|
||||
adding braces around your expression.: {:#?}",
|
||||
exp
|
||||
adding braces around your expression.: {exp:#?}"
|
||||
),
|
||||
)),
|
||||
}
|
||||
@ -244,7 +242,7 @@ impl PropList {
|
||||
if let Some(other_prop) = self.get_by_label(key) {
|
||||
return Err(syn::Error::new_spanned(
|
||||
&other_prop.label,
|
||||
format!("`{}` can only be specified once", key),
|
||||
format!("`{key}` can only be specified once"),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,13 +112,13 @@ error: `ref` can only be specified once
|
||||
63 | html! { <input ref={()} ref={()} /> };
|
||||
| ^^^
|
||||
|
||||
error: the tag `<input>` is a void element and cannot have children (hint: rewrite this as `<input/>`)
|
||||
error: the tag `<input>` is a void element and cannot have children (hint: rewrite this as `<input />`)
|
||||
--> tests/html_macro/element-fail.rs:66:13
|
||||
|
|
||||
66 | html! { <input type="text"></input> };
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: the tag `<iNpUt>` is a void element and cannot have children (hint: rewrite this as `<iNpUt/>`)
|
||||
error: the tag `<iNpUt>` is a void element and cannot have children (hint: rewrite this as `<iNpUt />`)
|
||||
--> tests/html_macro/element-fail.rs:68:13
|
||||
|
|
||||
68 | html! { <iNpUt type="text"></iNpUt> };
|
||||
|
||||
@ -73,16 +73,13 @@ fn parse_variants_attributes(
|
||||
0 => {
|
||||
return Err(syn::Error::new(
|
||||
variant.span(),
|
||||
format!(
|
||||
"{} attribute must be present on every variant",
|
||||
AT_ATTR_IDENT
|
||||
),
|
||||
format!("{AT_ATTR_IDENT} attribute must be present on every variant"),
|
||||
))
|
||||
}
|
||||
_ => {
|
||||
return Err(syn::Error::new_spanned(
|
||||
quote! { #(#at_attrs)* },
|
||||
format!("only one {} attribute must be present", AT_ATTR_IDENT),
|
||||
format!("only one {AT_ATTR_IDENT} attribute must be present"),
|
||||
))
|
||||
}
|
||||
};
|
||||
@ -117,7 +114,7 @@ fn parse_variants_attributes(
|
||||
if not_founds.len() > 1 {
|
||||
return Err(syn::Error::new_spanned(
|
||||
quote! { #(#not_found_attrs)* },
|
||||
format!("there can only be one {}", NOT_FOUND_ATTR_IDENT),
|
||||
format!("there can only be one {NOT_FOUND_ATTR_IDENT}"),
|
||||
));
|
||||
}
|
||||
|
||||
@ -174,8 +171,8 @@ impl Routable {
|
||||
// :param -> {param}
|
||||
// *param -> {param}
|
||||
// so we can pass it to `format!("...", param)`
|
||||
right = right.replace(&format!(":{}", field), &format!("{{{}}}", field));
|
||||
right = right.replace(&format!("*{}", field), &format!("{{{}}}", field));
|
||||
right = right.replace(&format!(":{field}"), &format!("{{{field}}}"));
|
||||
right = right.replace(&format!("*{field}"), &format!("{{{field}}}"));
|
||||
}
|
||||
|
||||
quote! {
|
||||
|
||||
@ -162,7 +162,7 @@ impl Navigator {
|
||||
if route_s.is_empty() && route_s.is_empty() {
|
||||
Cow::from("/")
|
||||
} else {
|
||||
Cow::from(format!("{}{}", base, route_s))
|
||||
Cow::from(format!("{base}{route_s}"))
|
||||
}
|
||||
}
|
||||
None => route_s.into(),
|
||||
@ -178,7 +178,7 @@ impl Navigator {
|
||||
.unwrap_or(path);
|
||||
|
||||
if !path.starts_with('/') {
|
||||
path = format!("/{}", m).into();
|
||||
path = format!("/{m}").into();
|
||||
}
|
||||
|
||||
path
|
||||
|
||||
@ -60,7 +60,7 @@ pub fn compose_path(pathname: &str, query: &str) -> Option<String> {
|
||||
let query = query.trim();
|
||||
|
||||
if !query.is_empty() {
|
||||
Some(format!("{}?{}", pathname, query))
|
||||
Some(format!("{pathname}?{query}"))
|
||||
} else {
|
||||
Some(pathname.to_owned())
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ pub fn link_href(selector: &str) -> String {
|
||||
gloo::utils::document()
|
||||
.query_selector(selector)
|
||||
.expect("Failed to run query selector")
|
||||
.unwrap_or_else(|| panic!("No such link: {}", selector))
|
||||
.unwrap_or_else(|| panic!("No such link: {selector}"))
|
||||
.get_attribute("href")
|
||||
.expect("No href attribute")
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ mod feat_hydration {
|
||||
|
||||
let node = fragment
|
||||
.pop_front()
|
||||
.unwrap_or_else(|| panic!("expected element of type {}, found EOF.", tag_name));
|
||||
.unwrap_or_else(|| panic!("expected element of type {tag_name}, found EOF."));
|
||||
|
||||
assert_eq!(
|
||||
node.node_type(),
|
||||
|
||||
@ -30,7 +30,7 @@ mod feat_hydration {
|
||||
.map(|m| m.tag_name().to_lowercase())
|
||||
.unwrap_or_else(|| "unknown".to_owned());
|
||||
|
||||
format!("{} element node", tag).into()
|
||||
format!("{tag} element node").into()
|
||||
}
|
||||
Node::ATTRIBUTE_NODE => "attribute node".into(),
|
||||
Node::TEXT_NODE => "text node".into(),
|
||||
|
||||
@ -75,7 +75,7 @@ where
|
||||
let data = data.clone();
|
||||
ctx.next_prepared_state(move |_re_render, buf| -> PreparedStateBase<T, D> {
|
||||
if let Some(buf) = buf {
|
||||
let buf = format!("data:application/octet-binary;base64,{}", buf);
|
||||
let buf = format!("data:application/octet-binary;base64,{buf}");
|
||||
|
||||
spawn_local(async move {
|
||||
let buf = decode_base64(&buf)
|
||||
|
||||
@ -101,7 +101,7 @@ mod feat_ssr_hydration {
|
||||
pub fn name(&self) -> Cow<'static, str> {
|
||||
match self {
|
||||
#[cfg(debug_assertions)]
|
||||
Self::Component(m) => format!("Component({})", m).into(),
|
||||
Self::Component(m) => format!("Component({m})").into(),
|
||||
#[cfg(not(debug_assertions))]
|
||||
Self::Component(_) => "Component".into(),
|
||||
Self::Suspense => "Suspense".into(),
|
||||
|
||||
@ -527,7 +527,7 @@ mod feat_ssr {
|
||||
let _ = w.write_str(">");
|
||||
} else {
|
||||
// We don't write children of void elements nor closing tags.
|
||||
debug_assert!(children.is_empty(), "{} cannot have any children!", tag);
|
||||
debug_assert!(children.is_empty(), "{tag} cannot have any children!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,8 +197,7 @@ fn create_progress(tests: usize, rounds: usize) -> ProgressBar {
|
||||
ProgressStyle::default_bar()
|
||||
.template(&format!(
|
||||
"{{spinner:.green}} {{prefix}} [{{elapsed_precise}}] [{{bar:40.cyan/blue}}] round \
|
||||
{{msg}}/{}",
|
||||
rounds
|
||||
{{msg}}/{rounds}",
|
||||
))
|
||||
.expect("failed to parse template")
|
||||
// .tick_chars("-\\|/")
|
||||
|
||||
@ -72,7 +72,7 @@ impl Cli {
|
||||
|
||||
let from_ref = match from {
|
||||
Some(some) => some,
|
||||
None => format!("refs/tags/{}-v{}", package, latest_version),
|
||||
None => format!("refs/tags/{package}-v{latest_version}"),
|
||||
};
|
||||
(from_ref, next_version)
|
||||
};
|
||||
|
||||
@ -19,7 +19,7 @@ pub fn create_log_line(
|
||||
oid: Result<Oid, Error>,
|
||||
token: Option<String>,
|
||||
) -> Result<Option<LogLine>> {
|
||||
println!("Commit oid: {:?}", oid);
|
||||
println!("Commit oid: {oid:?}");
|
||||
let oid = oid?;
|
||||
let commit = repo.find_commit(oid)?;
|
||||
let commit_first_line = commit
|
||||
@ -69,9 +69,9 @@ pub fn create_log_line(
|
||||
|
||||
let issue_labels = GITHUB_ISSUE_LABELS_FETCHER
|
||||
.lock()
|
||||
.map_err(|err| anyhow!("Failed to lock GITHUB_ISSUE_LABELS_FETCHER: {}", err))?
|
||||
.map_err(|err| anyhow!("Failed to lock GITHUB_ISSUE_LABELS_FETCHER: {err}"))?
|
||||
.fetch_issue_labels(issue_id.clone(), token)
|
||||
.with_context(|| format!("Could not find GitHub labels for issue: {}", issue_id))?;
|
||||
.with_context(|| format!("Could not find GitHub labels for issue: {issue_id}"))?;
|
||||
|
||||
let is_issue_for_this_package = issue_labels
|
||||
.iter()
|
||||
|
||||
@ -5,8 +5,8 @@ use semver::{Error, Version};
|
||||
use crate::yew_package::YewPackage;
|
||||
|
||||
pub fn get_latest_version(package: &YewPackage) -> Result<Version> {
|
||||
let common_tag_pattern = format!("{}-v", package);
|
||||
let search_pattern = format!("{}*", common_tag_pattern);
|
||||
let common_tag_pattern = format!("{package}-v");
|
||||
let search_pattern = format!("{common_tag_pattern}*");
|
||||
|
||||
let mut tags: Vec<Version> = Repository::open_from_env()?
|
||||
.tag_names(Some(&search_pattern))?
|
||||
|
||||
@ -10,7 +10,7 @@ pub fn github_fetch<T: DeserializeOwned>(url: &str, token: Option<String>) -> Re
|
||||
thread::sleep(Duration::from_secs(1));
|
||||
let mut optional_headers = HeaderMap::new();
|
||||
if let Some(token) = token {
|
||||
optional_headers.insert(AUTHORIZATION, format!("Bearer {}", token).parse().unwrap());
|
||||
optional_headers.insert(AUTHORIZATION, format!("Bearer {token}").parse().unwrap());
|
||||
}
|
||||
|
||||
let request_client = Client::new();
|
||||
@ -27,7 +27,7 @@ pub fn github_fetch<T: DeserializeOwned>(url: &str, token: Option<String>) -> Re
|
||||
bail!("GitHub API limit reached.");
|
||||
}
|
||||
}
|
||||
bail!("GitHub API request error: {}", status);
|
||||
bail!("GitHub API request error: {status}");
|
||||
}
|
||||
Ok(resp.json()?)
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ impl GitHubIssueLabelsFetcher {
|
||||
.or_insert_with(|| match Self::inner_fetch(&issue, token) {
|
||||
Ok(labels) => labels,
|
||||
Err(err) => {
|
||||
eprintln!("fetch_issue_labels Error: {}", err);
|
||||
eprintln!("fetch_issue_labels Error: {err}");
|
||||
None
|
||||
}
|
||||
})
|
||||
@ -34,10 +34,7 @@ impl GitHubIssueLabelsFetcher {
|
||||
}
|
||||
|
||||
fn inner_fetch(q: &str, token: Option<String>) -> Result<Option<Vec<String>>> {
|
||||
let url = format!(
|
||||
"https://api.github.com/repos/yewstack/yew/issues/{}/labels",
|
||||
q,
|
||||
);
|
||||
let url = format!("https://api.github.com/repos/yewstack/yew/issues/{q}/labels");
|
||||
let body: Vec<BodyListItem> = github_fetch(&url, token)?;
|
||||
let label_names: Vec<String> = body.into_iter().map(|label| label.name).collect();
|
||||
Ok(Some(label_names))
|
||||
|
||||
@ -32,7 +32,7 @@ impl GitHubUsersFetcher {
|
||||
.or_insert_with(|| match Self::inner_fetch(commit, token) {
|
||||
Ok(value) => value,
|
||||
Err(err) => {
|
||||
eprintln!("fetch_user_by_commit_author Error: {}", err);
|
||||
eprintln!("fetch_user_by_commit_author Error: {err}");
|
||||
None
|
||||
}
|
||||
})
|
||||
|
||||
@ -6,17 +6,17 @@ use anyhow::{Context, Result};
|
||||
|
||||
pub fn write_changelog(changelog_path: &str, version_changelog: &[u8]) -> Result<()> {
|
||||
let old_changelog = File::open(changelog_path)
|
||||
.context(format!("could not open {} for reading", changelog_path))?;
|
||||
.context(format!("could not open {changelog_path} for reading"))?;
|
||||
let old_changelog_reader = BufReader::new(old_changelog);
|
||||
|
||||
let changelog_path_new = &format!("../{}.new", changelog_path);
|
||||
let changelog_path_new = &format!("../{changelog_path}.new");
|
||||
|
||||
let mut new_changelog = fs::OpenOptions::new()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(true)
|
||||
.open(changelog_path_new)
|
||||
.context(format!("could not open {} for writing", changelog_path_new))?;
|
||||
.context(format!("could not open {changelog_path_new} for writing"))?;
|
||||
|
||||
new_changelog.write_all(version_changelog)?;
|
||||
|
||||
@ -26,10 +26,9 @@ pub fn write_changelog(changelog_path: &str, version_changelog: &[u8]) -> Result
|
||||
|
||||
drop(new_changelog);
|
||||
|
||||
fs::remove_file(changelog_path).context(format!("Could not delete {}", changelog_path))?;
|
||||
fs::remove_file(changelog_path).context(format!("Could not delete {changelog_path}"))?;
|
||||
fs::rename(changelog_path_new, changelog_path).context(format!(
|
||||
"Could not replace {} with {}",
|
||||
changelog_path, changelog_path_new
|
||||
"Could not replace {changelog_path} with {changelog_path_new}"
|
||||
))?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -14,11 +14,8 @@ pub fn write_log_lines(log_lines: Vec<LogLine>) -> Result<Vec<u8>> {
|
||||
{
|
||||
writeln!(
|
||||
logs_list,
|
||||
"- {message}. [[@{user}](https://github.com/{user}), [#{issue_id}](https://github.com/yewstack/yew/pull/{issue_id})]",
|
||||
message = message,
|
||||
user = user,
|
||||
issue_id = issue_id
|
||||
)?;
|
||||
"- {message}. [[@{user}](https://github.com/{user}), [#{issue_id}](https://github.com/yewstack/yew/pull/{issue_id})]",
|
||||
)?;
|
||||
}
|
||||
Ok(logs_list)
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ struct Level {
|
||||
|
||||
fn main() {
|
||||
let home = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let pattern = format!("{}/../../website/docs/**/*.md*", home);
|
||||
let base = format!("{}/../../website", home);
|
||||
let pattern = format!("{home}/../../website/docs/**/*.md*");
|
||||
let base = format!("{home}/../../website");
|
||||
let base = Path::new(&base).canonicalize().unwrap();
|
||||
let dir_pattern = format!("{}/../../website/docs/**", home);
|
||||
let dir_pattern = format!("{home}/../../website/docs/**");
|
||||
for dir in glob(&dir_pattern).unwrap() {
|
||||
println!("cargo:rerun-if-changed={}", dir.unwrap().display());
|
||||
}
|
||||
@ -63,7 +63,7 @@ impl Level {
|
||||
fn write_into(&self, dst: &mut String, name: &str, level: usize) -> fmt::Result {
|
||||
self.write_space(dst, level);
|
||||
let name = name.replace(|c| c == '-' || c == '.', "_");
|
||||
writeln!(dst, "pub mod {} {{", name)?;
|
||||
writeln!(dst, "pub mod {name} {{")?;
|
||||
|
||||
self.write_inner(dst, level + 1)?;
|
||||
|
||||
@ -92,7 +92,7 @@ impl Level {
|
||||
|
||||
writeln!(dst, "#[doc = include_str!(r\"{}\")]", file.display())?;
|
||||
self.write_space(dst, level);
|
||||
writeln!(dst, "pub fn {}_md() {{}}", stem)?;
|
||||
writeln!(dst, "pub fn {stem}_md() {{}}")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user