Define modules in lib.rs instead of main.rs
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use clippy_dev::clippy_project_root;
|
use crate::clippy_project_root;
|
||||||
use shell_escape::escape;
|
use shell_escape::escape;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ use std::fs;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
|
pub mod fmt;
|
||||||
|
pub mod new_lint;
|
||||||
|
pub mod stderr_length_check;
|
||||||
|
pub mod update_lints;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref DEC_CLIPPY_LINT_RE: Regex = Regex::new(
|
static ref DEC_CLIPPY_LINT_RE: Regex = Regex::new(
|
||||||
r#"(?x)
|
r#"(?x)
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ use clippy_dev::{
|
|||||||
};
|
};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
mod fmt;
|
use clippy_dev::{fmt, new_lint, stderr_length_check};
|
||||||
mod new_lint;
|
|
||||||
mod stderr_length_check;
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq)]
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
enum UpdateMode {
|
enum UpdateMode {
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
use clippy_dev::clippy_project_root;
|
use crate::clippy_project_root;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::ErrorKind;
|
use std::io::ErrorKind;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
/// Creates files required to implement and test a new lint and runs `update_lints`.
|
||||||
|
///
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// This function errors, if the files couldn't be created
|
||||||
pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str>) -> Result<(), io::Error> {
|
pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str>) -> Result<(), io::Error> {
|
||||||
let pass = pass.expect("`pass` argument is validated by clap");
|
let pass = pass.expect("`pass` argument is validated by clap");
|
||||||
let lint_name = lint_name.expect("`name` argument is validated by clap");
|
let lint_name = lint_name.expect("`name` argument is validated by clap");
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
|
use crate::clippy_project_root;
|
||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
use clippy_dev::clippy_project_root;
|
|
||||||
|
|
||||||
// The maximum length allowed for stderr files.
|
// The maximum length allowed for stderr files.
|
||||||
//
|
//
|
||||||
// We limit this because small files are easier to deal with than bigger files.
|
// We limit this because small files are easier to deal with than bigger files.
|
||||||
|
|||||||
Reference in New Issue
Block a user