Skip to content

Commit

Permalink
codegen: Don't import std::{fmt,cmp,hash} and use full qualifier instead
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Aug 16, 2023
1 parent f477238 commit 2302c6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/analysis/special_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,8 @@ pub fn analyze_imports(specials: &Infos, imports: &mut Imports) {
imports.add_with_version("glib::translate::*", info.version);
}
Compare => {
imports.add_with_version("std::cmp", info.version);
imports.add_with_version("glib::translate::*", info.version);
}
Display => imports.add_with_version("std::fmt", info.version),
Hash => imports.add_with_version("std::hash", info.version),
Equal => imports.add_with_version("glib::translate::*", info.version),
_ => {}
}
Expand Down
12 changes: 6 additions & 6 deletions src/codegen/trait_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ fn generate_display(
writeln!(
w,
"\
impl fmt::Display for {type_name} {{
impl std::fmt::Display for {type_name} {{
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {{
fn fmt(&self, f: &mut fmt::Formatter) -> std::fmt::Result {{
{body}
}}
}}"
Expand All @@ -168,9 +168,9 @@ fn generate_hash(
writeln!(
w,
"\
impl hash::Hash for {type_name} {{
impl std::hash::Hash for {type_name} {{
#[inline]
fn hash<H>(&self, state: &mut H) where H: hash::Hasher {{
fn hash<H>(&self, state: &mut H) where H: std::hash::Hasher {{
hash::Hash::hash(&{call}, state)
}}
}}"
Expand Down Expand Up @@ -258,14 +258,14 @@ fn generate_ord(
"\
impl PartialOrd for {type_name} {{
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {{
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {{
{call}.partial_cmp(&0)
}}
}}
impl Ord for {type_name} {{
#[inline]
fn cmp(&self, other: &Self) -> cmp::Ordering {{
fn cmp(&self, other: &Self) -> std::cmp::Ordering {{
{call}.cmp(&0)
}}
}}"
Expand Down

0 comments on commit 2302c6c

Please sign in to comment.