mirror of https://github.com/yewstack/yew
Use stable rust in CI for rustfmt and clippy (#829)
This commit is contained in:
parent
cc0be53382
commit
33351f3e2a
|
@ -16,12 +16,12 @@ before_cache:
|
|||
|
||||
rust:
|
||||
- 1.39.0 # min supported
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
- rust: beta
|
||||
fast_finish: true
|
||||
|
||||
install:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
echo "$(rustup default)" | grep -q "stable"
|
||||
if [ "$?" != "0" ]; then
|
||||
# only run checks on stable rust for stability
|
||||
# only run checks on stable
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
|
@ -101,12 +101,16 @@ impl ToTokens for HtmlComponent {
|
|||
|
||||
#[cfg(has_maybe_uninit)]
|
||||
let unallocated_prop_ref = quote! {
|
||||
let #prop_ref: <#ty as ::yew::html::Component>::Properties = unsafe { ::std::mem::MaybeUninit::uninit().assume_init() };
|
||||
let #prop_ref: <#ty as ::yew::html::Component>::Properties = unsafe {
|
||||
::std::mem::MaybeUninit::uninit().assume_init()
|
||||
};
|
||||
};
|
||||
|
||||
#[cfg(not(has_maybe_uninit))]
|
||||
let unallocated_prop_ref = quote! {
|
||||
let #prop_ref: <#ty as ::yew::html::Component>::Properties = unsafe { ::std::mem::uninitialized() };
|
||||
let #prop_ref: <#ty as ::yew::html::Component>::Properties = unsafe {
|
||||
::std::mem::uninitialized()
|
||||
};
|
||||
};
|
||||
|
||||
quote! {
|
||||
|
@ -154,12 +158,8 @@ impl ToTokens for HtmlComponent {
|
|||
};
|
||||
|
||||
let validate_comp = quote_spanned! { ty.span()=>
|
||||
trait __yew_validate_comp {
|
||||
type C: ::yew::html::Component;
|
||||
}
|
||||
impl __yew_validate_comp for () {
|
||||
type C = #ty;
|
||||
}
|
||||
trait __yew_validate_comp: ::yew::html::Component {}
|
||||
impl __yew_validate_comp for #ty {}
|
||||
};
|
||||
|
||||
let node_ref = if let Some(node_ref) = props.node_ref() {
|
||||
|
@ -169,7 +169,8 @@ impl ToTokens for HtmlComponent {
|
|||
};
|
||||
|
||||
tokens.extend(quote! {{
|
||||
// Validation nevers executes at runtime
|
||||
// These validation checks show a nice error message to the user.
|
||||
// They do not execute at runtime
|
||||
if false {
|
||||
#validate_comp
|
||||
#validate_props
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#[allow(dead_code)]
|
||||
#[rustversion::attr(stable(1.39.0), cfg_attr(not(feature = "web_test"), test))]
|
||||
#[rustversion::attr(stable(1.40.0), cfg_attr(not(feature = "web_test"), test))]
|
||||
fn tests() {
|
||||
let t = trybuild::TestCases::new();
|
||||
t.pass("tests/derive_props/pass.rs");
|
||||
|
|
|
@ -162,6 +162,7 @@ error[E0308]: mismatched types
|
|||
|
|
||||
72 | html! { <Child int=0u32 /> };
|
||||
| ^^^^ expected i32, found u32
|
||||
|
|
||||
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit
|
||||
|
|
||||
72 | html! { <Child int=0u32.try_into().unwrap() /> };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#[allow(dead_code)]
|
||||
#[rustversion::attr(stable(1.39.0), cfg_attr(not(feature = "web_test"), test))]
|
||||
#[rustversion::attr(stable(1.40.0), cfg_attr(not(feature = "web_test"), test))]
|
||||
fn tests() {
|
||||
let t = trybuild::TestCases::new();
|
||||
|
||||
|
|
Loading…
Reference in New Issue