From 85072fb471cde1aebf6137de20670f7bae7e8ea0 Mon Sep 17 00:00:00 2001 From: j178 <10510431+j178@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:23:24 +0800 Subject: [PATCH] Simplify --- src/languages/docker.rs | 5 ----- src/languages/fail.rs | 5 ----- src/languages/mod.rs | 1 - src/languages/node.rs | 5 ----- src/languages/python/impl.rs | 5 ----- src/languages/system.rs | 5 ----- 6 files changed, 26 deletions(-) diff --git a/src/languages/docker.rs b/src/languages/docker.rs index 7a61604..f713ea0 100644 --- a/src/languages/docker.rs +++ b/src/languages/docker.rs @@ -9,7 +9,6 @@ use anyhow::Result; use fancy_regex::Regex; use tracing::trace; -use crate::config::Language; use crate::fs::CWD; use crate::hook::Hook; use crate::languages::{LanguageImpl, DEFAULT_VERSION}; @@ -162,10 +161,6 @@ impl Docker { } impl LanguageImpl for Docker { - fn name(&self) -> Language { - Language::Docker - } - fn default_version(&self) -> &str { DEFAULT_VERSION } diff --git a/src/languages/fail.rs b/src/languages/fail.rs index 0d6489e..ba3741c 100644 --- a/src/languages/fail.rs +++ b/src/languages/fail.rs @@ -1,6 +1,5 @@ use std::{collections::HashMap, sync::Arc}; -use crate::config; use crate::hook::Hook; use crate::languages::{LanguageImpl, DEFAULT_VERSION}; @@ -8,10 +7,6 @@ use crate::languages::{LanguageImpl, DEFAULT_VERSION}; pub struct Fail; impl LanguageImpl for Fail { - fn name(&self) -> config::Language { - config::Language::Fail - } - fn default_version(&self) -> &str { DEFAULT_VERSION } diff --git a/src/languages/mod.rs b/src/languages/mod.rs index 00cce44..66b7303 100644 --- a/src/languages/mod.rs +++ b/src/languages/mod.rs @@ -21,7 +21,6 @@ static DOCKER: docker::Docker = docker::Docker; pub const DEFAULT_VERSION: &str = "default"; trait LanguageImpl { - fn name(&self) -> Language; fn default_version(&self) -> &str; fn environment_dir(&self) -> Option<&str>; async fn install(&self, hook: &Hook) -> Result<()>; diff --git a/src/languages/node.rs b/src/languages/node.rs index c4693e7..a40d7ae 100644 --- a/src/languages/node.rs +++ b/src/languages/node.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use std::sync::Arc; -use crate::config; use crate::hook::Hook; use crate::languages::{LanguageImpl, DEFAULT_VERSION}; @@ -9,10 +8,6 @@ use crate::languages::{LanguageImpl, DEFAULT_VERSION}; pub struct Node; impl LanguageImpl for Node { - fn name(&self) -> config::Language { - config::Language::Node - } - fn default_version(&self) -> &str { DEFAULT_VERSION } diff --git a/src/languages/python/impl.rs b/src/languages/python/impl.rs index b2d7005..759558e 100644 --- a/src/languages/python/impl.rs +++ b/src/languages/python/impl.rs @@ -2,7 +2,6 @@ use std::collections::HashMap; use std::path::{Path, PathBuf}; use std::sync::Arc; -use crate::config; use crate::hook::Hook; use crate::languages::python::uv::ensure_uv; use crate::languages::LanguageImpl; @@ -13,10 +12,6 @@ use crate::run::run_by_batch; pub struct Python; impl LanguageImpl for Python { - fn name(&self) -> config::Language { - config::Language::Python - } - fn default_version(&self) -> &str { // TODO find the version of python on the system "python3" diff --git a/src/languages/system.rs b/src/languages/system.rs index ea542e3..804dadb 100644 --- a/src/languages/system.rs +++ b/src/languages/system.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use std::sync::Arc; -use crate::config; use crate::hook::Hook; use crate::languages::{LanguageImpl, DEFAULT_VERSION}; use crate::process::Cmd; @@ -11,10 +10,6 @@ use crate::run::run_by_batch; pub struct System; impl LanguageImpl for System { - fn name(&self) -> config::Language { - config::Language::System - } - fn default_version(&self) -> &str { DEFAULT_VERSION }