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

adhoc: Fix Clippy lints in const-serialize etc. #3880

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/target
/packages/playwright-tests/web/dist
/packages/playwright-tests/fullstack/dist
/packages/playwright-tests/test-results
/dist
.DS_Store
/examples/assets/test_video.mp4
Expand Down
12 changes: 6 additions & 6 deletions packages/const-serialize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,18 +516,18 @@ const fn char_to_bytes(char: char) -> ([u8; 4], usize) {
bytes[0] = code as u8;
}
2 => {
bytes[0] = (code >> 6 & 0x1F) as u8 | BYTE_CHAR_BOUNDARIES[1];
bytes[0] = ((code >> 6) & 0x1F) as u8 | BYTE_CHAR_BOUNDARIES[1];
bytes[1] = (code & 0x3F) as u8 | CONTINUED_CHAR_MASK;
}
3 => {
bytes[0] = (code >> 12 & 0x0F) as u8 | BYTE_CHAR_BOUNDARIES[2];
bytes[1] = (code >> 6 & 0x3F) as u8 | CONTINUED_CHAR_MASK;
bytes[0] = ((code >> 12) & 0x0F) as u8 | BYTE_CHAR_BOUNDARIES[2];
bytes[1] = ((code >> 6) & 0x3F) as u8 | CONTINUED_CHAR_MASK;
bytes[2] = (code & 0x3F) as u8 | CONTINUED_CHAR_MASK;
}
4 => {
bytes[0] = (code >> 18 & 0x07) as u8 | BYTE_CHAR_BOUNDARIES[3];
bytes[1] = (code >> 12 & 0x3F) as u8 | CONTINUED_CHAR_MASK;
bytes[2] = (code >> 6 & 0x3F) as u8 | CONTINUED_CHAR_MASK;
bytes[0] = ((code >> 18) & 0x07) as u8 | BYTE_CHAR_BOUNDARIES[3];
bytes[1] = ((code >> 12) & 0x3F) as u8 | CONTINUED_CHAR_MASK;
bytes[2] = ((code >> 6) & 0x3F) as u8 | CONTINUED_CHAR_MASK;
bytes[3] = (code & 0x3F) as u8 | CONTINUED_CHAR_MASK;
}
_ => panic!(
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,12 @@ pub struct Template {

// Are identical static items merged in the current build. Rust doesn't have a cfg(merge_statics) attribute
// so we have to check this manually
#[allow(unpredictable_function_pointer_comparisons)] // This attribute should be removed once MSRV is 1.85 or greater and the below change is made
fn static_items_merged() -> bool {
fn a() {}
fn b() {}

a as fn() == b as fn()
// std::ptr::fn_addr_eq(a as fn(), b as fn()) <<<<---- This should replace the a as fn() === b as fn() once the MSRV is 1.85 or greater
}

impl std::hash::Hash for Template {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Config {
/// #
/// # fn main() {
/// let cfg = Config::new()
/// .with_asynchronous_custom_protocol("asset", |request, responder| {
/// .with_asynchronous_custom_protocol("asset", |id, request, responder| {
/// tokio::spawn(async move {
/// responder.respond(
/// HTTPResponse::builder()
Expand Down
4 changes: 2 additions & 2 deletions packages/dioxus/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl LaunchBuilder {
/// # Example
/// ```rust, no_run
/// use dioxus::prelude::*;
/// use dioxus_desktop::Config;
/// use dioxus_desktop::{Config, WindowBuilder};
///
/// fn app() -> Element {
/// rsx! {
Expand All @@ -203,7 +203,7 @@ impl LaunchBuilder {
/// }
///
/// dioxus::LaunchBuilder::desktop()
/// .with_cfg(Config::new().with_window(|w| w.with_title("My App")))
/// .with_cfg(Config::new().with_window(WindowBuilder::new().with_title("My App")))
/// .launch(app);
/// ```
pub fn with_cfg(mut self, config: impl LaunchConfig) -> Self {
Expand Down
1 change: 0 additions & 1 deletion packages/fullstack/src/serve_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ impl ServeConfigBuilder {

let index_path = self
.index_path
.map(PathBuf::from)
.unwrap_or_else(|| public_path.join("index.html"));

let root_id = self.root_id.unwrap_or("main");
Expand Down
7 changes: 4 additions & 3 deletions packages/html/src/events/mounted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ impl_event! [
///
/// The `MountedData` struct contains cross platform APIs that work on the desktop, mobile, liveview and web platforms. For the web platform, you can also downcast the `MountedData` event to the `web-sys::Element` type for more web specific APIs:
///
/// ```rust, no_run
/// # use dioxus::prelude::*;
/// # use dioxus_web::WebEventExt;
/// ```rust, ignore
/// use dioxus::prelude::*;
/// use dioxus_web::WebEventExt; // provides [`as_web_event()`] method
///
/// fn App() -> Element {
/// rsx! {
/// div {
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use tracing;
///
/// # Example
///
/// ```rust,no_run
/// ```rust, ignore
/// use dioxus::prelude::*;
/// use tracing::info;
///
Expand Down Expand Up @@ -55,7 +55,7 @@ pub fn initialize_default() {
///
/// # Example
///
/// ```rust,no_run
/// ```rust, ignore
/// use dioxus::prelude::*;
/// use dioxus::logger::tracing::{Level, info};
///
Expand Down
30 changes: 15 additions & 15 deletions packages/playwright-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/playwright-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.42.1"
"@playwright/test": "^1.51.0"
}
}
16 changes: 15 additions & 1 deletion packages/router/src/contexts/outlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,21 @@ impl<R> OutletContext<R> {
///
/// # Examples
///
/// ```rust
/// ```rust, no_run
/// # use dioxus_lib::prelude::*;
/// # use dioxus_router::prelude::{use_outlet_context,Routable};
///
/// # #[derive(Routable,Clone,PartialEq)]
/// # enum MyRouter {
/// # #[route("/")]
/// # MyView
/// # }
///
/// # #[component]
/// # fn MyView() -> Element {
/// # rsx!{ div { "My Text" } }
/// # }
///
/// let outlet_ctx = use_outlet_context::<MyRouter>();
/// println!("Current nesting level: {}", outlet_ctx.level());
/// ```
Expand Down
2 changes: 1 addition & 1 deletion packages/wasm-split/wasm-split-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub fn wasm_split(args: TokenStream, input: TokenStream) -> TokenStream {
/// Create a lazy loader for a given function. Meant to be used in statics. Designed for libraries to
/// integrate with.
///
/// ```rust, no_run
/// ```rust, ignore
/// fn SomeFunction(args: Args) -> Ret {}
///
/// static LOADER: wasm_split::LazyLoader<Args, Ret> = lazy_loader!(SomeFunction);
Expand Down
2 changes: 1 addition & 1 deletion packages/wasm-split/wasm-split/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl std::fmt::Display for SplitLoaderError {
/// which module the function should be loaded from. If you don't know which module to use, use `auto`
/// and wasm-split will automatically combine all the modules into one.
///
/// ```rust, no_run
/// ```rust, ignore
/// static LOADER: wasm_split::LazyLoader<Args, Ret> = wasm_split::lazy_loader!(extern "auto" fn SomeFunction(args: Args) -> Ret);
///
/// fn SomeFunction(args: Args) -> Ret {
Expand Down