mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Fix nightly lints and various small CI issues (#3857)
* fix lint span location `feature(proc_macro_span)` has been partially stabilized in 1.89 (currently nightly) so use it without feature config now. * fix various other small lints that got added over time * use build-examples binary in size-cmp to unify build process * adjust optimization flags to newer nightly compiler
This commit is contained in:
parent
718cd29eea
commit
a86c4f847f
9
.github/workflows/size-cmp.yml
vendored
9
.github/workflows/size-cmp.yml
vendored
@ -32,9 +32,10 @@ jobs:
|
||||
|
||||
- name: Write Optimisation Flags
|
||||
run: |
|
||||
echo 'share-generics = true' >> .cargo/config.toml
|
||||
echo 'build-std = ["std", "panic_abort"]' >> .cargo/config.toml
|
||||
echo 'build-std-features = ["panic_immediate_abort"]' >> .cargo/config.toml
|
||||
echo '[build]' >> .cargo/config.toml
|
||||
echo 'rustflags = ["-Cpanic=abort"]' >> .cargo/config.toml
|
||||
|
||||
- name: Setup toolchain
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
@ -54,11 +55,7 @@ jobs:
|
||||
version: "latest"
|
||||
|
||||
- name: Build examples
|
||||
run: find ./*/index.html | xargs -I '{}' trunk build --release '{}' || exit 0
|
||||
working-directory: examples
|
||||
env:
|
||||
RUSTUP_TOOLCHAIN: nightly
|
||||
RUSTFLAGS: --cfg nightly_yew
|
||||
run: cargo run -p build-examples --bin build-examples
|
||||
|
||||
- name: Collect size information
|
||||
run: python3 ci/collect_sizes.py
|
||||
|
||||
@ -9,16 +9,12 @@ import json
|
||||
def find_example_sizes(parent_dir: Path) -> Dict[str, int]:
|
||||
example_sizes: Dict[str, int] = {}
|
||||
|
||||
for example_dir in (parent_dir / "examples").iterdir():
|
||||
|
||||
if not example_dir.is_dir():
|
||||
print(f"{example_dir} is not a directory.")
|
||||
continue
|
||||
for example_dist_dir in (parent_dir / "dist").iterdir():
|
||||
|
||||
total_size = 0
|
||||
|
||||
# For examples with multiple bundles, we add them together.
|
||||
for bundle in (example_dir / "dist").glob(f"*.wasm"):
|
||||
for bundle in example_dist_dir.glob(f"*.wasm"):
|
||||
size = bundle.stat().st_size
|
||||
|
||||
print(f"{bundle} has a size of {size}.")
|
||||
@ -26,7 +22,7 @@ def find_example_sizes(parent_dir: Path) -> Dict[str, int]:
|
||||
total_size += size
|
||||
|
||||
if total_size > 0:
|
||||
example_sizes[example_dir.name] = total_size
|
||||
example_sizes[example_dist_dir.name] = total_size
|
||||
|
||||
return example_sizes
|
||||
|
||||
|
||||
@ -454,17 +454,16 @@ impl ToTokens for HtmlElement {
|
||||
}}
|
||||
});
|
||||
|
||||
#[cfg(nightly_yew)]
|
||||
let invalid_void_tag_msg_start = {
|
||||
#[rustversion::since(1.89)]
|
||||
fn derive_debug_tag(vtag: &Ident) -> String {
|
||||
let span = vtag.span().unwrap();
|
||||
let source_file = span.source_file().path();
|
||||
let source_file = source_file.display();
|
||||
let start = span.start();
|
||||
format!("[{}:{}:{}] ", source_file, start.line(), start.column())
|
||||
};
|
||||
|
||||
#[cfg(not(nightly_yew))]
|
||||
let invalid_void_tag_msg_start = "";
|
||||
format!("[{}:{}:{}] ", span.file(), span.line(), span.column())
|
||||
}
|
||||
#[rustversion::before(1.89)]
|
||||
fn derive_debug_tag(_: &Ident) -> &'static str {
|
||||
""
|
||||
}
|
||||
let invalid_void_tag_msg_start = derive_debug_tag(&vtag);
|
||||
|
||||
let value = value();
|
||||
let checked = checked();
|
||||
|
||||
@ -27,6 +27,7 @@ pub fn lint<L>(tree: &HtmlTree)
|
||||
where
|
||||
L: Lint,
|
||||
{
|
||||
let _ = L::lint;
|
||||
#[cfg(not(yew_lints))]
|
||||
let _ = tree;
|
||||
#[cfg(yew_lints)]
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#![cfg_attr(nightly_yew, feature(proc_macro_span))]
|
||||
|
||||
//! This crate provides Yew's procedural macro `html!` which allows using JSX-like syntax
|
||||
//! for generating html and the `Properties` derive macro for deriving the `Properties` trait
|
||||
//! for components.
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#[allow(missing_docs)]
|
||||
//! Internal module for unit tests
|
||||
pub mod layout_tests;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user