Skip to content

Commit

Permalink
Merge imports from the same module into a single use statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeisler committed Feb 26, 2022
1 parent 76255a3 commit 4bbb4b9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions benches/indent.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use criterion::Criterion;
use criterion::{criterion_group, criterion_main};
use criterion::{criterion_group, criterion_main, Criterion};

pub fn benchmark(c: &mut Criterion) {
// Generate a piece of text with some empty lines.
Expand Down
4 changes: 1 addition & 3 deletions benches/linear.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::time::Duration;

use criterion::BenchmarkId;
use criterion::Criterion;
use criterion::{criterion_group, criterion_main};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};

// The benchmarks here verify that the complexity grows as O(*n*)
// where *n* is the number of characters in the text to be wrapped.
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 = "Module"
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ mod readme_doctest {}
use std::borrow::Cow;

mod indentation;
pub use crate::indentation::dedent;
pub use crate::indentation::indent;
pub use crate::indentation::{dedent, indent};

mod word_separators;
pub use word_separators::WordSeparator;
Expand Down Expand Up @@ -358,7 +357,7 @@ impl<'a> Options<'a> {
/// initial indentation and wrapping each paragraph by itself:
///
/// ```
/// use textwrap::{Options, wrap};
/// use textwrap::{wrap, Options};
///
/// let options = Options::new(16).initial_indent(" ");
/// assert_eq!(wrap("This is a little example.", options),
Expand All @@ -383,7 +382,7 @@ impl<'a> Options<'a> {
/// single paragraph as a bullet list:
///
/// ```
/// use textwrap::{Options, wrap};
/// use textwrap::{wrap, Options};
///
/// let options = Options::new(12)
/// .initial_indent("* ")
Expand Down
6 changes: 3 additions & 3 deletions src/word_separators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ pub enum WordSeparator {
///
/// ```
/// #[cfg(feature = "unicode-linebreak")] {
/// use textwrap::WordSeparator::UnicodeBreakProperties;
/// use textwrap::core::Word;
/// use textwrap::WordSeparator::UnicodeBreakProperties;
///
/// assert_eq!(UnicodeBreakProperties.find_words("Emojis: 😂😍").collect::<Vec<_>>(),
/// vec![Word::from("Emojis: "),
Expand All @@ -93,8 +93,8 @@ pub enum WordSeparator {
///
/// ```
/// #[cfg(feature = "unicode-linebreak")] {
/// use textwrap::WordSeparator::UnicodeBreakProperties;
/// use textwrap::core::Word;
/// use textwrap::WordSeparator::UnicodeBreakProperties;
///
/// assert_eq!(UnicodeBreakProperties.find_words("Emojis: 😂\u{2060}😍").collect::<Vec<_>>(),
/// vec![Word::from("Emojis: "),
Expand All @@ -107,8 +107,8 @@ pub enum WordSeparator {
///
/// ```
/// #[cfg(feature = "unicode-linebreak")] {
/// use textwrap::WordSeparator::UnicodeBreakProperties;
/// use textwrap::core::Word;
/// use textwrap::WordSeparator::UnicodeBreakProperties;
///
/// assert_eq!(UnicodeBreakProperties.find_words("[ foo ] bar !").collect::<Vec<_>>(),
/// vec![Word::from("[ foo ] "),
Expand Down
2 changes: 1 addition & 1 deletion src/wrap_algorithms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ impl Default for WrapAlgorithm {
/// on your estimates. You can model this with a program like this:
///
/// ```
/// use textwrap::wrap_algorithms::wrap_first_fit;
/// use textwrap::core::{Fragment, Word};
/// use textwrap::wrap_algorithms::wrap_first_fit;
///
/// #[derive(Debug)]
/// struct Task<'a> {
Expand Down
4 changes: 2 additions & 2 deletions src/wrap_algorithms/optimal_fit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub struct Penalties {
/// character in extreme cases:
///
/// ```
/// use textwrap::wrap_algorithms::{wrap_optimal_fit, Penalties};
/// use textwrap::core::Word;
/// use textwrap::wrap_algorithms::{wrap_optimal_fit, Penalties};
///
/// let short = "foo ";
/// let long = "x".repeat(50);
Expand Down Expand Up @@ -276,7 +276,7 @@ impl std::error::Error for OverflowError {}
///
/// ```
/// use textwrap::core::Fragment;
/// use textwrap::wrap_algorithms::{wrap_optimal_fit, Penalties, OverflowError};
/// use textwrap::wrap_algorithms::{wrap_optimal_fit, OverflowError, Penalties};
///
/// #[derive(Debug, PartialEq)]
/// struct Word(f64);
Expand Down

0 comments on commit 4bbb4b9

Please sign in to comment.