From 6ede4fee5e6c22980cb7b207432b8fb828082807 Mon Sep 17 00:00:00 2001 From: tuhana Date: Tue, 2 Jul 2024 21:36:18 +0300 Subject: [PATCH] Organise imports --- src/cli/install.rs | 9 ++++----- src/cli/list.rs | 10 +++++----- src/cli/mod.rs | 4 ++-- src/types/node/lts.rs | 2 +- src/types/platforms.rs | 8 ++++---- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/cli/install.rs b/src/cli/install.rs index 85cad8e..9645fca 100644 --- a/src/cli/install.rs +++ b/src/cli/install.rs @@ -1,8 +1,7 @@ -use std::{fmt, str}; - use clap::Args; use super::NueCommand; + use crate::{exts::HyperlinkExt, types}; #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] @@ -88,8 +87,8 @@ impl NueCommand for CommandArguments { } } -impl fmt::Display for VersionInputs { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +impl ::std::fmt::Display for VersionInputs { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::VersionString(version) => write!(f, "{}", version), Self::Latest => write!(f, "latest"), @@ -99,7 +98,7 @@ impl fmt::Display for VersionInputs { } } -impl std::str::FromStr for VersionInputs { +impl ::std::str::FromStr for VersionInputs { type Err = anyhow::Error; fn from_str(s: &str) -> Result { diff --git a/src/cli/list.rs b/src/cli/list.rs index 3b6c636..ab8dd34 100644 --- a/src/cli/list.rs +++ b/src/cli/list.rs @@ -1,9 +1,9 @@ use clap::Args; -use crate::{exts::HyperlinkExt, types}; - use super::NueCommand; +use crate::{exts::HyperlinkExt, types}; + #[derive(Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] enum VersionInputs { VersionString(String), @@ -123,8 +123,8 @@ fn print_version_tree(releases: &[types::node::Release]) -> String { tree_string } -impl std::fmt::Display for VersionInputs { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl ::std::fmt::Display for VersionInputs { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::VersionString(version) => write!(f, "{}", version), Self::All => write!(f, "all"), @@ -134,7 +134,7 @@ impl std::fmt::Display for VersionInputs { } } -impl std::str::FromStr for VersionInputs { +impl ::std::str::FromStr for VersionInputs { type Err = anyhow::Error; fn from_str(s: &str) -> Result { diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 9e3b569..95fbac1 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,8 +1,8 @@ +use clap::{Args, Parser, Subcommand}; + mod install; mod list; -use clap::{Args, Parser, Subcommand}; - pub trait NueCommand { type Arguments: Args; diff --git a/src/types/node/lts.rs b/src/types/node/lts.rs index ca54cee..15bf70f 100644 --- a/src/types/node/lts.rs +++ b/src/types/node/lts.rs @@ -19,7 +19,7 @@ struct NodeLTSVisitor; impl<'de> Visitor<'de> for NodeLTSVisitor { type Value = NodeLTS; - fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + fn expecting(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { formatter.write_str("a string or a boolean") } diff --git a/src/types/platforms.rs b/src/types/platforms.rs index 53d2ec4..20c3d8b 100644 --- a/src/types/platforms.rs +++ b/src/types/platforms.rs @@ -42,8 +42,8 @@ impl Platform { } } -impl std::fmt::Display for Platform { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl ::std::fmt::Display for Platform { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::Linux(arch) => write!(f, "linux-{}", arch), } @@ -67,8 +67,8 @@ impl std::fmt::Display for Platform { // } // } -impl std::fmt::Display for Arch { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl ::std::fmt::Display for Arch { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { Self::ARM64 => write!(f, "arm64"), Self::ARMv7l => write!(f, "armv7l"),