fix: allow to name module std in project (#4353)

add missing prefix '::' for use of 'core' or 'std' module

RELATED #4331
This commit is contained in:
David Bernard authored and GitHub committed 2025-07-02 08:03:13 -05:00
1 parent d5bc480f6f
commit a66bffb487
5 files changed
+19 -19

No files matched your search

+7 -7
View File
@@ -491,7 +491,7 @@ impl RouteEnum {
quote! {
impl std::fmt::Display for #name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
#[allow(unused)]
match self {
#(#display_match)*
@@ -514,14 +514,14 @@ impl RouteEnum {
quote! {
impl<'a> ::core::convert::TryFrom<&'a str> for #name {
type Error = <Self as std::str::FromStr>::Err;
type Error = <Self as ::std::str::FromStr>::Err;
fn try_from(s: &'a str) -> ::std::result::Result<Self, Self::Error> {
s.parse()
}
}
impl std::str::FromStr for #name {
impl ::std::str::FromStr for #name {
type Err = dioxus_router::routable::RouteParseError<#error_name>;
fn from_str(s: &str) -> ::std::result::Result<Self, Self::Err> {
@@ -646,14 +646,14 @@ impl RouteEnum {
#(#error_variants),*
}
impl std::fmt::Debug for #match_error_name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl ::std::fmt::Debug for #match_error_name {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(f, "{}({})", stringify!(#match_error_name), self)
}
}
impl std::fmt::Display for #match_error_name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl ::std::fmt::Display for #match_error_name {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
#(#display_match),*
}
+4 -4
View File
@@ -180,8 +180,8 @@ impl Route {
let child = field.ident.as_ref().unwrap();
quote! {
Self::#name { #(#dynamic_segments,)* #child } => {
use std::fmt::Display;
use std::fmt::Write;
use ::std::fmt::Display;
use ::std::fmt::Write;
let mut route = String::new();
{
let f = &mut route;
@@ -334,8 +334,8 @@ impl Route {
}
}
impl<T: std::fmt::Display> std::fmt::Display for NoPartialEq<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<T: ::std::fmt::Display> ::std::fmt::Display for NoPartialEq<T> {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
self.0.fmt(f)
}
}
+4 -4
View File
@@ -314,14 +314,14 @@ pub(crate) fn create_error_type(
#(#error_variants,)*
}
impl std::fmt::Debug for #error_name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl ::std::fmt::Debug for #error_name {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
write!(f, "{}({})", stringify!(#error_name), self)
}
}
impl std::fmt::Display for #error_name {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl ::std::fmt::Display for #error_name {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
Self::ExtraSegments(segments) => {
write!(f, "Found additional trailing segments: {}", segments)?