Skip to content

Commit a86c4f8

Browse files
authored
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
1 parent 718cd29 commit a86c4f8

File tree

6 files changed

+17
-26
lines changed

6 files changed

+17
-26
lines changed

.github/workflows/size-cmp.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ jobs:
3232

3333
- name: Write Optimisation Flags
3434
run: |
35-
echo 'share-generics = true' >> .cargo/config.toml
3635
echo 'build-std = ["std", "panic_abort"]' >> .cargo/config.toml
3736
echo 'build-std-features = ["panic_immediate_abort"]' >> .cargo/config.toml
37+
echo '[build]' >> .cargo/config.toml
38+
echo 'rustflags = ["-Cpanic=abort"]' >> .cargo/config.toml
3839
3940
- name: Setup toolchain
4041
uses: dtolnay/rust-toolchain@master
@@ -54,11 +55,7 @@ jobs:
5455
version: "latest"
5556

5657
- name: Build examples
57-
run: find ./*/index.html | xargs -I '{}' trunk build --release '{}' || exit 0
58-
working-directory: examples
59-
env:
60-
RUSTUP_TOOLCHAIN: nightly
61-
RUSTFLAGS: --cfg nightly_yew
58+
run: cargo run -p build-examples --bin build-examples
6259

6360
- name: Collect size information
6461
run: python3 ci/collect_sizes.py

ci/collect_sizes.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,20 @@
99
def find_example_sizes(parent_dir: Path) -> Dict[str, int]:
1010
example_sizes: Dict[str, int] = {}
1111

12-
for example_dir in (parent_dir / "examples").iterdir():
13-
14-
if not example_dir.is_dir():
15-
print(f"{example_dir} is not a directory.")
16-
continue
12+
for example_dist_dir in (parent_dir / "dist").iterdir():
1713

1814
total_size = 0
1915

2016
# For examples with multiple bundles, we add them together.
21-
for bundle in (example_dir / "dist").glob(f"*.wasm"):
17+
for bundle in example_dist_dir.glob(f"*.wasm"):
2218
size = bundle.stat().st_size
2319

2420
print(f"{bundle} has a size of {size}.")
2521

2622
total_size += size
2723

2824
if total_size > 0:
29-
example_sizes[example_dir.name] = total_size
25+
example_sizes[example_dist_dir.name] = total_size
3026

3127
return example_sizes
3228

packages/yew-macro/src/html_tree/html_element.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -454,17 +454,16 @@ impl ToTokens for HtmlElement {
454454
}}
455455
});
456456

457-
#[cfg(nightly_yew)]
458-
let invalid_void_tag_msg_start = {
457+
#[rustversion::since(1.89)]
458+
fn derive_debug_tag(vtag: &Ident) -> String {
459459
let span = vtag.span().unwrap();
460-
let source_file = span.source_file().path();
461-
let source_file = source_file.display();
462-
let start = span.start();
463-
format!("[{}:{}:{}] ", source_file, start.line(), start.column())
464-
};
465-
466-
#[cfg(not(nightly_yew))]
467-
let invalid_void_tag_msg_start = "";
460+
format!("[{}:{}:{}] ", span.file(), span.line(), span.column())
461+
}
462+
#[rustversion::before(1.89)]
463+
fn derive_debug_tag(_: &Ident) -> &'static str {
464+
""
465+
}
466+
let invalid_void_tag_msg_start = derive_debug_tag(&vtag);
468467

469468
let value = value();
470469
let checked = checked();

packages/yew-macro/src/html_tree/lint/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub fn lint<L>(tree: &HtmlTree)
2727
where
2828
L: Lint,
2929
{
30+
let _ = L::lint;
3031
#[cfg(not(yew_lints))]
3132
let _ = tree;
3233
#[cfg(yew_lints)]

packages/yew-macro/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg_attr(nightly_yew, feature(proc_macro_span))]
2-
31
//! This crate provides Yew's procedural macro `html!` which allows using JSX-like syntax
42
//! for generating html and the `Properties` derive macro for deriving the `Properties` trait
53
//! for components.

packages/yew/src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#[allow(missing_docs)]
1+
//! Internal module for unit tests
22
pub mod layout_tests;

0 commit comments

Comments
 (0)