Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions sway-fmt-v2/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ pub const DEFAULT_ENUM_VARIANT_ALIGN_THRESHOLD: usize = 0;
pub const DEFAULT_MAX_COMMENT_WIDTH: usize = 80;

/////NEWLINE_STYLE/////
pub const LINE_FEED: char = '\n';
pub const CARRIAGE_RETURN: char = '\r';
pub const WINDOWS_NEWLINE: &str = "\r\n";
pub const UNIX_NEWLINE: &str = "\n";

pub(crate) const LINE_FEED: char = '\n';
pub(crate) const CARRIAGE_RETURN: char = '\r';
pub(crate) const WINDOWS_NEWLINE: &str = "\r\n";
pub(crate) const UNIX_NEWLINE: &str = "\n";

/////INDENT_STYLE/////

// INDENT_BUFFER.len() = 81
pub(crate) const INDENT_BUFFER_LEN: usize = 80;
pub(crate) const INDENT_BUFFER: &str =
"\n ";
// 8096 is close enough to infinite according to `rustfmt`.
pub(crate) const INFINITE_SHAPE_WIDTH: usize = 8096;
2 changes: 1 addition & 1 deletion sway-fmt-v2/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use crate::{
error::{ConfigError, FormatterError},
};

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct Formatter {
pub config: Config,
}
Expand Down
2 changes: 1 addition & 1 deletion sway-fmt-v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod constants;
mod error;
mod fmt;
mod items;
mod newline_style;
mod utils;

pub use crate::fmt::Formatter;
pub use error::FormatterError;
2 changes: 2 additions & 0 deletions sway-fmt-v2/src/utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod indent_style;
pub mod newline_style;
Loading