Skip to content

Commit

Permalink
Remove inject-libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwonz committed Sep 28, 2024
1 parent fed176a commit 81440d6
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 397 deletions.
269 changes: 0 additions & 269 deletions src/rules/inject_libraries.rs

This file was deleted.

5 changes: 0 additions & 5 deletions src/rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mod convert_require;
mod empty_do;
mod filter_early_return;
mod group_local;
mod inject_libraries;
mod inject_value;
mod method_def;
mod no_local_function;
Expand Down Expand Up @@ -46,7 +45,6 @@ pub use convert_require::*;
pub use empty_do::*;
pub use filter_early_return::*;
pub use group_local::*;
pub use inject_libraries::*;
pub use inject_value::*;
pub use method_def::*;
pub use no_local_function::*;
Expand Down Expand Up @@ -227,7 +225,6 @@ pub fn get_default_rules() -> Vec<Box<dyn Rule>> {
Box::<RemoveFunctionCallParens>::default(),
Box::<RemoveGeneralizedIteration>::default(),
Box::<RemoveRedeclaredKeys>::default(),
Box::<InjectLibraries>::default(),
Box::<RemoveContinue>::default(),
Box::<RemoveIfExpression>::default(),
]
Expand Down Expand Up @@ -260,7 +257,6 @@ pub fn get_all_rule_names() -> Vec<&'static str> {
RENAME_VARIABLES_RULE_NAME,
REMOVE_GENERALIZED_ITERATION_RULE_NAME,
REMOVE_REDECLARED_KEYS_RULE_NAME,
INJECT_LIBRARIES_RULE_NAME,
REMOVE_CONTINUE_RULE_NAME,
REMOVE_IF_EXPRESSION_RULE_NAME,
]
Expand Down Expand Up @@ -298,7 +294,6 @@ impl FromStr for Box<dyn Rule> {
RENAME_VARIABLES_RULE_NAME => Box::<RenameVariables>::default(),
REMOVE_GENERALIZED_ITERATION_RULE_NAME => Box::<RemoveGeneralizedIteration>::default(),
REMOVE_REDECLARED_KEYS_RULE_NAME => Box::<RemoveRedeclaredKeys>::default(),
INJECT_LIBRARIES_RULE_NAME => Box::<InjectLibraries>::default(),
REMOVE_CONTINUE_RULE_NAME => Box::<RemoveContinue>::default(),
REMOVE_IF_EXPRESSION_RULE_NAME => Box::<RemoveIfExpression>::default(),
_ => return Err(format!("invalid rule name: {}", string)),
Expand Down
20 changes: 1 addition & 19 deletions src/rules/rule_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use regex::Regex;
use serde::{Deserialize, Serialize};

use super::{
require::PathRequireMode, Library, RequireMode, RobloxRequireMode, RuleConfigurationError,
require::PathRequireMode, RequireMode, RobloxRequireMode, RuleConfigurationError,
};

pub type RuleProperties = HashMap<String, RulePropertyValue>;
Expand All @@ -20,7 +20,6 @@ pub enum RulePropertyValue {
Float(f64),
StringList(Vec<String>),
RequireMode(RequireMode),
Libraries(Vec<Library>),
None,
}

Expand Down Expand Up @@ -85,17 +84,6 @@ impl RulePropertyValue {
_ => Err(RuleConfigurationError::RequireModeExpected(key.to_owned())),
}
}

pub(crate) fn expect_libraries(
self,
key: &str,
) -> Result<Vec<Library>, RuleConfigurationError> {
if let Self::Libraries(value) = self {
Ok(value)
} else {
Err(RuleConfigurationError::LibrariesExpected(key.to_owned()))
}
}
}

impl From<bool> for RulePropertyValue {
Expand Down Expand Up @@ -153,12 +141,6 @@ impl From<&RequireMode> for RulePropertyValue {
}
}

// impl From<&Library> for RulePropertyValue {
// fn from(value: &Library) -> Self {
// Self::Library(value.clone())
// }
// }

impl<T: Into<RulePropertyValue>> From<Option<T>> for RulePropertyValue {
fn from(value: Option<T>) -> Self {
match value {
Expand Down
Loading

0 comments on commit 81440d6

Please sign in to comment.