Define modules in lib.rs instead of main.rs

This commit is contained in:
flip1995 2020-03-31 15:09:11 +02:00
parent 09fe163c92
commit 8b9d70d349
No known key found for this signature in database
GPG key ID: 2CEFCDB27ED0BE79
5 changed files with 14 additions and 8 deletions

View file

@ -1,4 +1,4 @@
use clippy_dev::clippy_project_root;
use crate::clippy_project_root;
use shell_escape::escape;
use std::ffi::OsStr;
use std::io;

View file

@ -9,6 +9,11 @@ use std::fs;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;
pub mod fmt;
pub mod new_lint;
pub mod stderr_length_check;
pub mod update_lints;
lazy_static! {
static ref DEC_CLIPPY_LINT_RE: Regex = Regex::new(
r#"(?x)

View file

@ -7,9 +7,7 @@ use clippy_dev::{
};
use std::path::Path;
mod fmt;
mod new_lint;
mod stderr_length_check;
use clippy_dev::{fmt, new_lint, stderr_length_check};
#[derive(Clone, Copy, PartialEq)]
enum UpdateMode {

View file

@ -1,10 +1,15 @@
use clippy_dev::clippy_project_root;
use crate::clippy_project_root;
use std::fs::{File, OpenOptions};
use std::io;
use std::io::prelude::*;
use std::io::ErrorKind;
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> {
let pass = pass.expect("`pass` argument is validated by clap");
let lint_name = lint_name.expect("`name` argument is validated by clap");

View file

@ -1,11 +1,9 @@
use crate::clippy_project_root;
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};
use walkdir::WalkDir;
use clippy_dev::clippy_project_root;
// The maximum length allowed for stderr files.
//
// We limit this because small files are easier to deal with than bigger files.