Use stable rust in CI for rustfmt and clippy (#829)

This commit is contained in:
Justin Starry 2019-12-28 21:08:30 -06:00 committed by GitHub
parent cc0be53382
commit 33351f3e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 14 deletions

View File

@ -16,12 +16,12 @@ before_cache:
rust: rust:
- 1.39.0 # min supported - 1.39.0 # min supported
- stable
- beta - beta
- nightly
matrix: matrix:
allow_failures: allow_failures:
- rust: nightly - rust: beta
fast_finish: true fast_finish: true
install: install:

View File

@ -2,7 +2,7 @@
echo "$(rustup default)" | grep -q "stable" echo "$(rustup default)" | grep -q "stable"
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
# only run checks on stable rust for stability # only run checks on stable
exit 0 exit 0
fi fi

View File

@ -101,12 +101,16 @@ impl ToTokens for HtmlComponent {
#[cfg(has_maybe_uninit)] #[cfg(has_maybe_uninit)]
let unallocated_prop_ref = quote! { 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))] #[cfg(not(has_maybe_uninit))]
let unallocated_prop_ref = quote! { 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! { quote! {
@ -154,12 +158,8 @@ impl ToTokens for HtmlComponent {
}; };
let validate_comp = quote_spanned! { ty.span()=> let validate_comp = quote_spanned! { ty.span()=>
trait __yew_validate_comp { trait __yew_validate_comp: ::yew::html::Component {}
type C: ::yew::html::Component; impl __yew_validate_comp for #ty {}
}
impl __yew_validate_comp for () {
type C = #ty;
}
}; };
let node_ref = if let Some(node_ref) = props.node_ref() { let node_ref = if let Some(node_ref) = props.node_ref() {
@ -169,7 +169,8 @@ impl ToTokens for HtmlComponent {
}; };
tokens.extend(quote! {{ 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 { if false {
#validate_comp #validate_comp
#validate_props #validate_props

View File

@ -1,5 +1,5 @@
#[allow(dead_code)] #[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() { fn tests() {
let t = trybuild::TestCases::new(); let t = trybuild::TestCases::new();
t.pass("tests/derive_props/pass.rs"); t.pass("tests/derive_props/pass.rs");

View File

@ -162,6 +162,7 @@ error[E0308]: mismatched types
| |
72 | html! { <Child int=0u32 /> }; 72 | html! { <Child int=0u32 /> };
| ^^^^ expected i32, found u32 | ^^^^ expected i32, found u32
|
help: you can convert an `u32` to `i32` and panic if the converted value wouldn't fit 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() /> }; 72 | html! { <Child int=0u32.try_into().unwrap() /> };

View File

@ -1,5 +1,5 @@
#[allow(dead_code)] #[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() { fn tests() {
let t = trybuild::TestCases::new(); let t = trybuild::TestCases::new();