Skip to content

Commit

Permalink
Normalize fmt imports.
Browse files Browse the repository at this point in the history
Always prefer importing `core::fmt` (or `std::fmt`) instead of importing
its items or using it fully qualified (except for trait bounds).
  • Loading branch information
kpreid committed Dec 15, 2023
1 parent 9358b46 commit 6eea1ba
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions all-is-cubes-mesh/src/block_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! This module is internal and reexported by its parent.
use std::fmt::Debug;
use std::fmt;
use std::sync::Arc;

use all_is_cubes::block::{AnimationChange, EvaluatedBlock, Evoxel, Evoxels, Resolution};
Expand Down Expand Up @@ -615,8 +615,8 @@ where
}
}

impl<M: MeshTypes> Debug for BlockMesh<M> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<M: MeshTypes> fmt::Debug for BlockMesh<M> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self {
face_vertices,
interior_vertices,
Expand Down
10 changes: 5 additions & 5 deletions all-is-cubes-mesh/src/space_mesh.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fmt::Debug;
use std::fmt;
use std::ops::Range;

use bitvec::vec::BitVec;
Expand Down Expand Up @@ -441,8 +441,8 @@ impl<M: MeshTypes> PartialEq for SpaceMesh<M> {
}
}

impl<M: MeshTypes> Debug for SpaceMesh<M> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<M: MeshTypes> fmt::Debug for SpaceMesh<M> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self {
vertices,
indices,
Expand Down Expand Up @@ -781,8 +781,8 @@ impl<M: MeshTypes> PartialEq for MeshMeta<M> {
}
}

impl<M: MeshTypes> Debug for MeshMeta<M> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl<M: MeshTypes> fmt::Debug for MeshMeta<M> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self {
opaque_range,
transparent_ranges,
Expand Down
2 changes: 1 addition & 1 deletion all-is-cubes-ui/src/vui/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl LayoutRequest {
}

impl Fmt<ConciseDebug> for LayoutRequest {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>, _: &ConciseDebug) -> core::fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>, _: &ConciseDebug) -> fmt::Result {
let &Self { minimum } = self;
write!(fmt, "{:?}", minimum.to_array())
}
Expand Down
13 changes: 7 additions & 6 deletions all-is-cubes/src/chunking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use alloc::collections::BTreeMap;
use alloc::sync::Arc;
use alloc::vec::Vec;
use core::fmt;
use core::iter::FusedIterator;
use core::ops::RangeTo;

Expand Down Expand Up @@ -42,8 +43,8 @@ type Ccv = Vector3D<i32, WholeChunk>;
#[allow(clippy::exhaustive_structs)]
pub struct ChunkPos<const CHUNK_SIZE: GridCoordinate>(pub Cube);

impl<const CHUNK_SIZE: GridCoordinate> core::fmt::Debug for ChunkPos<CHUNK_SIZE> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl<const CHUNK_SIZE: GridCoordinate> fmt::Debug for ChunkPos<CHUNK_SIZE> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self(Cube { x, y, z }) = *self;
write!(f, "ChunkPos<{CHUNK_SIZE}>({x}, {y}, {z})")
}
Expand Down Expand Up @@ -126,8 +127,8 @@ pub struct Distance {
off_plane_count: u8,
}

impl core::fmt::Debug for Distance {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl fmt::Debug for Distance {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Distance {
nearest_approach_squared,
off_plane_count,
Expand Down Expand Up @@ -386,8 +387,8 @@ pub struct OctantMask {
flags: u8,
}

impl core::fmt::Debug for OctantMask {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
impl fmt::Debug for OctantMask {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "OctantMask[")?;
let mut first = true;
for i in 0..8 {
Expand Down
2 changes: 1 addition & 1 deletion all-is-cubes/src/transaction/tester.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use alloc::boxed::Box;
use alloc::rc::Rc;
use alloc::vec::Vec;
use core::fmt::Debug;
use std::error::Error;
use std::fmt::Debug;

use super::Transaction;

Expand Down
2 changes: 1 addition & 1 deletion all-is-cubes/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mod error_chain {
/// Formatting wrapper which prints an [`Error`] together with its
/// `source()` chain, with at least one newline between each.
///
/// The text begins with the [`core::fmt::Display`] format of the error.
/// The text begins with the [`fmt::Display`] format of the error.
///
/// Design note: This is not a [`manyfmt::Fmt`] because that has a blanket implementation
/// which interferes with this one for [`Error`].
Expand Down

0 comments on commit 6eea1ba

Please sign in to comment.