Skip to content

Commit

Permalink
fixes to error messages and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
its-the-shrimp committed Oct 22, 2023
1 parent a6ca242 commit 1c39a1d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/suspense/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn app_content() -> HtmlResult {

Ok(html! {
<div class="content-area">
<textarea value={value.to_string()} oninput={on_text_input}/>
<textarea value={value.to_string()} oninput={on_text_input} />
<div class="action-area">
<button onclick={on_take_a_break}>{"Take a break!"}</button>
<div class="hint">{"You can take a break at anytime"}<br />{"and your work will be preserved."}</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/yew-macro/src/html_tree/html_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ impl Parse for HtmlElement {
"textarea" => {
return Err(syn::Error::new_spanned(
open.to_spanned(),
"the tag `<textarea>` is a void element and cannot have children (hint: \
to provide default value to it, rewrite it as <textarea \
defaultvalue={x}/>",
"the tag `<textarea>` is a void element and cannot have children \
(hint: to provide value to it, rewrite it as `<textarea value={x} />`. \
If you wish to set the default value, rewrite it as `<textarea defaultvalue={x} />`)",
))
}

Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/html_macro/element-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ error: the tag `<input>` is a void element and cannot have children (hint: rewri
66 | html! { <input type="text"></input> };
| ^^^^^^^^^^^^^^^^^^^

error: the tag `<textarea>` is a void element and cannot have children (hint: to provide default value to it, rewrite it as <textarea defaultvalue={x}/>
error: the tag `<textarea>` is a void element and cannot have children (hint: to provide value to it, rewrite it as `<textarea value={x} />`. If you wish to set the default value, rewrite it as `<textarea defaultvalue={x} />`)
--> tests/html_macro/element-fail.rs:68:13
|
68 | html! { <textarea>{"default value"}</textarea> }
Expand Down
10 changes: 5 additions & 5 deletions packages/yew/src/dom_bundle/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ mod feat_hydration {
#[cfg(feature = "hydration")]
pub(super) use feat_hydration::*;

#[cfg(test)]
// this is needed because clippy doesn't like the import not being used
#[allow(unused_imports)]
pub(super) use tests::*;

#[cfg(test)]
mod tests {
#![allow(dead_code)]
Expand Down Expand Up @@ -87,8 +92,3 @@ mod tests {
(root, scope, parent, sibling)
}
}

#[cfg(test)]
// this is needed because clippy doesn't like the import not being used
#[allow(unused_imports)]
pub(super) use tests::*;
2 changes: 0 additions & 2 deletions packages/yew/src/virtual_dom/vlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ mod feat_ssr {
.await;
}
_ => {
// No idea why but clippy doesn't recognise the need for `w` to be mutable
#[allow(clippy::needless_pass_by_ref_mut)]
async fn render_child_iter<'a, I>(
mut children: I,
w: &mut BufWriter,
Expand Down

0 comments on commit 1c39a1d

Please sign in to comment.