From b4e8067262f6dc66197469255705c29ae6ba2434 Mon Sep 17 00:00:00 2001 From: Brian Myers Date: Sun, 9 Oct 2022 18:57:56 -0400 Subject: [PATCH] [num-format-dev] Remove automatic running of rustfmt --- num-format-dev/Cargo.toml | 4 ---- num-format-dev/src/create_module.rs | 21 ++------------------- num-format-dev/src/lib.rs | 4 ---- num-format-dev/src/rustfmt.rs | 24 ------------------------ 4 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 num-format-dev/src/rustfmt.rs diff --git a/num-format-dev/Cargo.toml b/num-format-dev/Cargo.toml index 71e9c55..4f09264 100644 --- a/num-format-dev/Cargo.toml +++ b/num-format-dev/Cargo.toml @@ -12,10 +12,6 @@ anyhow = "1.0.65" indexmap = "1.9.1" proc-macro2 = "1.0.46" quote = "1.0.21" -rustfmt-nightly = { version = "1.4.21", optional = true } serde = { version = "1.0.145", features = ["derive"] } serde_json = "1.0.85" walkdir = "2.3.2" - -[features] -nightly = ["rustfmt-nightly"] diff --git a/num-format-dev/src/create_module.rs b/num-format-dev/src/create_module.rs index 99404d1..085c717 100644 --- a/num-format-dev/src/create_module.rs +++ b/num-format-dev/src/create_module.rs @@ -2,27 +2,10 @@ use indexmap::IndexMap; use proc_macro2::{Delimiter, Group, Ident, Literal, Span}; use quote::quote; -#[cfg(feature = "nightly")] -use crate::rustfmt::rustfmt; use crate::utils::Format; -#[cfg(feature = "nightly")] /// Takes the map returned from `parse_data` and turns it into a rust module. pub fn create_module(data: &IndexMap) -> Result { - let s = _create_module(data)?; - let s = rustfmt(s)?; - Ok(s) -} - -#[cfg(not(feature = "nightly"))] -/// Takes the map returned from `parse_data` and turns it into a rust module. -pub fn create_module(data: &IndexMap) -> Result { - let s = _create_module(data)?; - Ok(s) -} - -/// Takes the map returned from `parse_data` and turns it into a rust module. -fn _create_module(data: &IndexMap) -> Result { let variant_names = data.keys().map(|s| Ident::new(s, Span::call_site())); let mut decimals = Vec::new(); @@ -119,8 +102,8 @@ fn _create_module(data: &IndexMap) -> Result(module: S) -> Result -where - S: Into, -{ - let input = Input::Text(module.into()); - - let mut config = Config::default(); - config.set().edition(Edition::Edition2018); - config.set().emit_mode(EmitMode::Stdout); - // config.set().max_width(200); - - let mut output = Vec::new(); - { - let mut session = Session::new(config, Some(&mut output)); - let _format_report = session.format(input)?; - } - let s = String::from_utf8(output)?; - Ok(s) -}