Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #3679

Merged
merged 9 commits into from
Jul 25, 2024
2 changes: 1 addition & 1 deletion examples/todomvc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Component for App {
.filter(|e| self.state.filter.fits(e))
.nth(idx)
.unwrap();
self.state.edit_value = entry.description.clone();
self.state.edit_value.clone_from(&entry.description);
self.state.clear_all_edit();
self.state.toggle_edit(idx);
}
Expand Down
1 change: 1 addition & 0 deletions packages/yew-macro/src/html_tree/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::props::{ElementProps, Prop};
/// use `proc-macro-error` (and the `emit_warning!` macro) to produce a warning. At present, these
/// are only emitted on nightly.
pub trait Lint {
#[cfg_attr(not(yew_lints), allow(dead_code))]
fn lint(element: &HtmlElement);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/yew-router/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub(crate) fn strip_slash_suffix(path: &str) -> &str {

static BASE_URL_LOADED: std::sync::Once = std::sync::Once::new();
thread_local! {
static BASE_URL: RefCell<Option<String>> = RefCell::new(None);
static BASE_URL: RefCell<Option<String>> = const { RefCell::new(None) };
}

// This exists so we can cache the base url. It costs us a `to_string` call instead of a DOM API
Expand Down
1 change: 1 addition & 0 deletions packages/yew/src/html/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ impl IntoIterator for &Classes {
}
}

#[allow(clippy::to_string_trait_impl)]
impl ToString for Classes {
fn to_string(&self) -> String {
let mut iter = self.set.iter().cloned();
Expand Down
9 changes: 4 additions & 5 deletions packages/yew/src/html/component/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ where
/// methods.
pub(crate) trait Stateful {
fn view(&self) -> HtmlResult;
#[cfg(feature = "csr")]
fn rendered(&mut self, first_render: bool);
fn destroy(&mut self);

fn any_scope(&self) -> AnyScope;

fn flush_messages(&mut self) -> bool;
#[cfg(feature = "csr")]
fn props_changed(&mut self, props: Rc<dyn Any>) -> bool;

fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;

#[cfg(feature = "hydration")]
fn creation_mode(&self) -> RenderMode;
Expand All @@ -171,6 +172,7 @@ where
self.component.view(&self.context)
}

#[cfg(feature = "csr")]
fn rendered(&mut self, first_render: bool) {
self.component.rendered(&self.context, first_render)
}
Expand Down Expand Up @@ -199,6 +201,7 @@ where
})
}

#[cfg(feature = "csr")]
fn props_changed(&mut self, props: Rc<dyn Any>) -> bool {
let props = match Rc::downcast::<COMP::Properties>(props) {
Ok(m) => m,
Expand All @@ -216,10 +219,6 @@ where
fn as_any(&self) -> &dyn Any {
self
}

fn as_any_mut(&mut self) -> &mut dyn Any {
self
}
}

pub(crate) struct ComponentState {
Expand Down
2 changes: 1 addition & 1 deletion packages/yew/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::app_handle::AppHandle;
use crate::html::BaseComponent;

thread_local! {
static PANIC_HOOK_IS_SET: Cell<bool> = Cell::new(false);
static PANIC_HOOK_IS_SET: Cell<bool> = const { Cell::new(false) };
}

/// Set a custom panic hook.
Expand Down
1 change: 1 addition & 0 deletions packages/yew/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl TopologicalQueue {

/// Take a single entry, preferring parents over children
#[rustversion::since(1.66)]
#[allow(clippy::incompatible_msrv)]
#[inline]
fn pop_topmost(&mut self) -> Option<QueueEntry> {
self.inner.pop_first().map(|(_, v)| v)
Expand Down
7 changes: 3 additions & 4 deletions packages/yew/src/virtual_dom/vlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ impl Deref for VList {
match self.children {
Some(ref m) => m,
None => {
// This is mutable because the Vec<VNode> is not Sync
static mut EMPTY: Vec<VNode> = Vec::new();
// SAFETY: The EMPTY value is always read-only
unsafe { &EMPTY }
// This can be replaced with `const { &Vec::new() }` in Rust 1.79.
const EMPTY: &Vec<VNode> = &Vec::new();
EMPTY
}
}
}
Expand Down
1 change: 1 addition & 0 deletions tools/website-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::needless_doctest_main)]
pub mod tutorial;

include!(concat!(env!("OUT_DIR"), "/website_tests.rs"));
Loading