Skip to content

Commit

Permalink
Merge #68
Browse files Browse the repository at this point in the history
68: Apply rustfmt to more places r=taiki-e a=taiki-e



Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Oct 7, 2019
2 parents d06efa8 + 7b87813 commit 5010225
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# EditorConfig configuration
# http://EditorConfig.org
# https://editorconfig.org

# Top-most EditorConfig file
root = true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ jobs:
- name: cargo test
if: matrix.rust != '1.31.0'
run: |
cargo test --all --no-default-features
cargo test --all
cargo test --features type_analysis
cargo test --all --tests --no-default-features
cargo test --all --tests
cargo test --tests --features type_analysis
- name: cargo test --all-features
if: matrix.rust == 'nightly'
run: |
Expand Down
10 changes: 8 additions & 2 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
version = "Two"
# Rustfmt configuration
# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md

version = "Two" # https://github.com/rust-lang/rustfmt/issues/3383
use_small_heuristics = "Max"
merge_imports = true # https://github.com/rust-lang/rustfmt/issues/3362
format_code_in_doc_comments = true # https://github.com/rust-lang/rustfmt/issues/3348

# Set the default settings again to always apply the proper formatting without being affected by the editor settings.
# Set the default settings again to always apply the proper formatting without
# being affected by the editor settings.
# Refs: https://github.com/rust-lang/rls/issues/501#issuecomment-333717736
edition = "2018"
tab_spaces = 4
6 changes: 4 additions & 2 deletions core/src/auto_enum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ mod expr;
mod type_analysis;
mod visitor;

use self::context::{Context, VisitLastMode, VisitMode, DEFAULT_MARKER};
use self::expr::child_expr;
use self::{
context::{Context, VisitLastMode, VisitMode, DEFAULT_MARKER},
expr::child_expr,
};

/// The attribute name.
const NAME: &str = "auto_enum";
Expand Down
19 changes: 5 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,13 @@
//! When using `#[auto_enum]` for expressions and statements, `#[auto_enum]` for
//! function is unnecessary.
//!
#![cfg_attr(feature = "unstable", doc = "```rust")]
#![cfg_attr(not(feature = "unstable"), doc = "```ignore")]
//! ```rust
//! // Add this to your crate root:
//! #![feature(proc_macro_hygiene, stmt_expr_attributes)]
//! # fn main() {}
//! ```
//!
#![cfg_attr(feature = "unstable", doc = "```rust")]
#![cfg_attr(not(feature = "unstable"), doc = "```ignore")]
//! ```rust
//! # #![cfg_attr(feature = "try_trait", feature(try_trait))]
//! # #![feature(proc_macro_hygiene, stmt_expr_attributes)]
//! # use auto_enums::auto_enum;
Expand All @@ -548,24 +546,18 @@
//!
//! You can also return closures.
//!
#![cfg_attr(feature = "fn_traits", doc = "```rust")]
#![cfg_attr(not(feature = "fn_traits"), doc = "```ignore")]
//! ```rust
//! // Add this to your crate root:
//! #![feature(fn_traits, unboxed_closures)]
//! # fn main() {}
//! ```
//!
#![cfg_attr(feature = "fn_traits", doc = "```rust")]
#![cfg_attr(not(feature = "fn_traits"), doc = "```ignore")]
//! ```rust
//! # #![feature(fn_traits, unboxed_closures)]
//! # use auto_enums::auto_enum;
//! #[auto_enum(Fn)]
//! fn foo(x: bool) -> impl Fn(i32) -> i32 {
//! if x {
//! |y| y + 1
//! } else {
//! |z| z - 1
//! }
//! if x { |y| y + 1 } else { |z| z - 1 }
//! }
//! # fn main() { let _ = foo(false); }
//! ```
Expand Down Expand Up @@ -829,7 +821,6 @@
//! * There needs to explicitly specify the trait to be implemented (`type_analysis` crate feature reduces this limitation).
//!
//! * There needs to be marker macros for unsupported expressions.
//!
#![no_std]
#![recursion_limit = "256"]
Expand Down

0 comments on commit 5010225

Please sign in to comment.