Skip to content

Commit

Permalink
Enforce merged imports
Browse files Browse the repository at this point in the history
Closes #281
  • Loading branch information
lambda-fairy committed Sep 11, 2021
1 parent c9cb58d commit 09c9934
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 44 deletions.
16 changes: 6 additions & 10 deletions docs/src/bin/build_nav.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
use comrak::nodes::AstNode;
use comrak::{self, Arena};
use docs::page::{Page, COMRAK_OPTIONS};
use docs::string_writer::StringWriter;
use comrak::{self, nodes::AstNode, Arena};
use docs::{
page::{Page, COMRAK_OPTIONS},
string_writer::StringWriter,
};
use serde_json;
use std::env;
use std::error::Error;
use std::fs;
use std::io;
use std::path::Path;
use std::str;
use std::{env, error::Error, fs, io, path::Path, str};

fn main() -> Result<(), Box<dyn Error>> {
let args = env::args().collect::<Vec<_>>();
Expand Down
39 changes: 24 additions & 15 deletions docs/src/bin/build_page.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
use comrak::nodes::{AstNode, NodeCodeBlock, NodeHeading, NodeHtmlBlock, NodeLink, NodeValue};
use comrak::{self, Arena};
use docs::page::{Page, COMRAK_OPTIONS};
use docs::views;
use comrak::{
self,
nodes::{AstNode, NodeCodeBlock, NodeHeading, NodeHtmlBlock, NodeLink, NodeValue},
Arena,
};
use docs::{
page::{Page, COMRAK_OPTIONS},
views,
};
use serde_json;
use std::env;
use std::error::Error;
use std::fs::{self, File};
use std::io::BufReader;
use std::mem;
use std::path::Path;
use std::str::{self, Utf8Error};
use std::string::FromUtf8Error;
use syntect::highlighting::{Color, ThemeSet};
use syntect::html::highlighted_html_for_string;
use syntect::parsing::SyntaxSet;
use std::{
env,
error::Error,
fs::{self, File},
io::BufReader,
mem,
path::Path,
str::{self, Utf8Error},
string::FromUtf8Error,
};
use syntect::{
highlighting::{Color, ThemeSet},
html::highlighted_html_for_string,
parsing::SyntaxSet,
};

fn main() -> Result<(), Box<dyn Error>> {
let args = env::args().collect::<Vec<_>>();
Expand Down
11 changes: 5 additions & 6 deletions docs/src/page.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use comrak::nodes::{AstNode, NodeHeading, NodeValue};
use comrak::{Arena, ComrakOptions};
use std::fs;
use std::io;
use std::lazy::SyncLazy;
use std::path::Path;
use comrak::{
nodes::{AstNode, NodeHeading, NodeValue},
Arena, ComrakOptions,
};
use std::{fs, io, lazy::SyncLazy, path::Path};

pub struct Page<'a> {
pub title: Option<&'a AstNode<'a>>,
Expand Down
3 changes: 1 addition & 2 deletions docs/src/string_writer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::io;
use std::str;
use std::{io, str};

pub struct StringWriter<'a>(pub &'a mut String);

Expand Down
6 changes: 4 additions & 2 deletions docs/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ use comrak::nodes::AstNode;
use maud::{html, Markup, PreEscaped, Render, DOCTYPE};
use std::str;

use crate::page::{Page, COMRAK_OPTIONS};
use crate::string_writer::StringWriter;
use crate::{
page::{Page, COMRAK_OPTIONS},
string_writer::StringWriter,
};

struct Comrak<'a>(&'a AstNode<'a>);

Expand Down
21 changes: 12 additions & 9 deletions maud/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,13 @@ mod iron_support {
extern crate std;

use crate::PreEscaped;
use alloc::boxed::Box;
use alloc::string::String;
use iron::headers::ContentType;
use iron::modifier::{Modifier, Set};
use iron::modifiers::Header;
use iron::response::{Response, WriteBody};
use alloc::{boxed::Box, string::String};
use iron::{
headers::ContentType,
modifier::{Modifier, Set},
modifiers::Header,
response::{Response, WriteBody},
};
use std::io;

impl Modifier<Response> for PreEscaped<String> {
Expand All @@ -205,9 +206,11 @@ mod rocket_support {

use crate::PreEscaped;
use alloc::string::String;
use rocket::http::{ContentType, Status};
use rocket::request::Request;
use rocket::response::{Responder, Response};
use rocket::{
http::{ContentType, Status},
request::Request,
response::{Responder, Response},
};
use std::io::Cursor;

impl Responder<'static> for PreEscaped<String> {
Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imports_granularity = "Crate"

0 comments on commit 09c9934

Please sign in to comment.