Use nightly rustfmt with rustfmt.toml (#536)

This commit is contained in:
Charlie Marsh 2022-11-01 20:34:38 -04:00 committed by GitHub
parent c68c6b5424
commit 79ca66ace5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 277 additions and 202 deletions

View file

@ -1,12 +1,10 @@
use std::collections::HashMap;
use anyhow::Result;
use ruff::flake8_quotes;
use ruff::flake8_quotes::settings::Quote;
use ruff::pep8_naming;
use ruff::settings::options::Options;
use ruff::settings::pyproject::Pyproject;
use ruff::{flake8_quotes, pep8_naming};
use crate::parser;

View file

@ -5,7 +5,6 @@ use std::path::PathBuf;
use anyhow::Result;
use clap::Parser;
use configparser::ini::Ini;
use flake8_to_ruff::converter;
#[derive(Parser)]
@ -14,7 +13,8 @@ use flake8_to_ruff::converter;
long_about = None
)]
struct Cli {
/// Path to the Flake8 configuration file (e.g., 'setup.cfg', 'tox.ini', or '.flake8').
/// Path to the Flake8 configuration file (e.g., 'setup.cfg', 'tox.ini', or
/// '.flake8').
#[arg(required = true)]
file: PathBuf,
}

View file

@ -4,13 +4,13 @@ use std::str::FromStr;
use anyhow::Result;
use once_cell::sync::Lazy;
use regex::Regex;
use ruff::checks_gen::CheckCodePrefix;
use ruff::settings::types::PatternPrefixPair;
static COMMA_SEPARATED_LIST_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"[,\s]").unwrap());
/// Parse a comma-separated list of `CheckCodePrefix` values (e.g., "F401,E501").
/// Parse a comma-separated list of `CheckCodePrefix` values (e.g.,
/// "F401,E501").
pub fn parse_prefix_codes(value: &str) -> Vec<CheckCodePrefix> {
let mut codes: Vec<CheckCodePrefix> = vec![];
for code in COMMA_SEPARATED_LIST_RE.split(value) {
@ -184,7 +184,6 @@ pub fn collect_per_file_ignores(
#[cfg(test)]
mod tests {
use anyhow::Result;
use ruff::checks_gen::CheckCodePrefix;
use ruff::settings::types::PatternPrefixPair;