Skip to main content

Module expr

Module expr 

Source

Re-exportsΒ§

use std::borrow::Cow; πŸ”’
use std::cmp::min; πŸ”’
use itertools::Itertools; πŸ”’
use rustc_ast::token::Delimiter; πŸ”’
use rustc_ast::token::Lit; πŸ”’
use rustc_ast::token::LitKind; πŸ”’
use rustc_ast::ForLoopKind; πŸ”’
use rustc_ast::MatchKind; πŸ”’
use rustc_ast::ast; πŸ”’
use rustc_ast::token; πŸ”’
use rustc_span::BytePos; πŸ”’
use rustc_span::Span; πŸ”’
use tracing::debug; πŸ”’
use crate::chains::rewrite_chain; πŸ”’
use crate::closures; πŸ”’
use crate::comment::CharClasses; πŸ”’
use crate::comment::FindUncommented; πŸ”’
use crate::comment::combine_strs_with_missing_comments; πŸ”’
use crate::comment::contains_comment; πŸ”’
use crate::comment::recover_comment_removed; πŸ”’
use crate::comment::rewrite_comment; πŸ”’
use crate::comment::rewrite_missing_comment; πŸ”’
use crate::config::Config; πŸ”’
use crate::config::ControlBraceStyle; πŸ”’
use crate::config::HexLiteralCase; πŸ”’
use crate::config::IndentStyle; πŸ”’
use crate::config::StyleEdition; πŸ”’
use crate::config::FloatLiteralTrailingZero; πŸ”’
use crate::lists::ListFormatting; πŸ”’
use crate::lists::Separator; πŸ”’
use crate::lists::definitive_tactic; πŸ”’
use crate::lists::itemize_list; πŸ”’
use crate::lists::shape_for_tactic; πŸ”’
use crate::lists::struct_lit_formatting; πŸ”’
use crate::lists::struct_lit_shape; πŸ”’
use crate::lists::struct_lit_tactic; πŸ”’
use crate::lists::write_list; πŸ”’
use crate::macros::MacroPosition; πŸ”’
use crate::macros::rewrite_macro; πŸ”’
use crate::matches::rewrite_match; πŸ”’
use crate::overflow; πŸ”’
use crate::overflow::IntoOverflowableItem; πŸ”’
use crate::overflow::OverflowableItem; πŸ”’
use crate::pairs::PairParts; πŸ”’
use crate::pairs::rewrite_all_pairs; πŸ”’
use crate::pairs::rewrite_pair; πŸ”’
use crate::range::rewrite_range; πŸ”’
use crate::rewrite::Rewrite; πŸ”’
use crate::rewrite::RewriteContext; πŸ”’
use crate::rewrite::RewriteError; πŸ”’
use crate::rewrite::RewriteErrorExt; πŸ”’
use crate::rewrite::RewriteResult; πŸ”’
use crate::shape::Indent; πŸ”’
use crate::shape::Shape; πŸ”’
use crate::source_map::LineRangeUtils; πŸ”’
use crate::source_map::SpanUtils; πŸ”’
use crate::spanned::Spanned; πŸ”’
use crate::stmt; πŸ”’
use crate::string::StringFormat; πŸ”’
use crate::string::rewrite_string; πŸ”’
use crate::types::PathContext; πŸ”’
use crate::types::rewrite_path; πŸ”’
use crate::utils::colon_spaces; πŸ”’
use crate::utils::contains_skip; πŸ”’
use crate::utils::count_newlines; πŸ”’
use crate::utils::filtered_str_fits; πŸ”’
use crate::utils::first_line_ends_with; πŸ”’
use crate::utils::inner_attributes; πŸ”’
use crate::utils::last_line_extendable; πŸ”’
use crate::utils::last_line_width; πŸ”’
use crate::utils::mk_sp; πŸ”’
use crate::utils::outer_attributes; πŸ”’
use crate::utils::semicolon_for_expr; πŸ”’
use crate::utils::unicode_str_width; πŸ”’
use crate::utils::wrap_str; πŸ”’
use crate::vertical::rewrite_with_alignment; πŸ”’
use crate::visitor::FmtVisitor; πŸ”’
use crate::config::lists::*; πŸ”’

StructsΒ§

ControlFlow πŸ”’
FloatSymbolParts πŸ”’
Indicates the parts of a float literal specified as a string.

EnumsΒ§

ExprType πŸ”’
RhsAssignKind πŸ”’
RhsTactics πŸ”’
Controls where to put the rhs.

FunctionsΒ§

block_contains_comment πŸ”’
block_has_statements πŸ”’
block_prefix πŸ”’
can_be_overflowed_expr πŸ”’
choose_matcher πŸ”’
choose_rhs πŸ”’
choose_separator_tactic πŸ”’
extract_comment πŸ”’
extract_pats_and_cond πŸ”’
float_lit_ends_in_dot πŸ”’
format_expr πŸ”’
is_empty_block πŸ”’
Checks whether a block contains no statements, expressions, comments, or inner attributes.
is_every_expr_simple πŸ”’
is_method_call πŸ”’
is_nested_call πŸ”’
is_simple_block πŸ”’
is_simple_block_stmt πŸ”’
Checks whether a block contains at most one statement or expression, and no comments or attributes.
is_simple_expr πŸ”’
is_unsafe_block πŸ”’
last_line_offsetted πŸ”’
Returns true if the last line of pat_str has leading whitespace and it is wider than the shape’s indent.
lit_ends_in_dot πŸ”’
parse_float_symbol πŸ”’
Parses a float literal. The symbol must be a valid floating point literal without a type suffix. Otherwise the function may panic or return wrong result.
prefer_next_line πŸ”’
Returns true if formatting next_line_rhs is better on a new line when compared to the original’s line formatting.
rewrite_array πŸ”’
rewrite_assign_rhs πŸ”’
rewrite_assign_rhs_expr πŸ”’
rewrite_assign_rhs_with πŸ”’
rewrite_assign_rhs_with_comments πŸ”’
rewrite_assignment πŸ”’
rewrite_block πŸ”’
rewrite_block_inner πŸ”’
rewrite_block_with_visitor πŸ”’
rewrite_call πŸ”’
rewrite_cond πŸ”’
rewrite_else_kw_with_comments πŸ”’
Rewrite the else keyword with surrounding comments.
rewrite_empty_block πŸ”’
rewrite_expr_addrof πŸ”’
rewrite_field πŸ”’
rewrite_float_lit πŸ”’
rewrite_index πŸ”’
rewrite_int_lit πŸ”’
rewrite_label πŸ”’
rewrite_let πŸ”’
rewrite_let_else_block πŸ”’
Rewrite the divergent block of a let-else statement.
rewrite_literal πŸ”’
rewrite_paren πŸ”’
rewrite_paren_in_multi_line πŸ”’
rewrite_single_line_block πŸ”’
rewrite_string_lit πŸ”’
rewrite_struct_lit πŸ”’
rewrite_tuple πŸ”’
rewrite_tuple_in_visual_indent_style πŸ”’
rewrite_unary_op πŸ”’
rewrite_unary_prefix πŸ”’
rewrite_unary_suffix πŸ”’
shape_from_rhs_tactic πŸ”’
span_ends_with_comma πŸ”’
Returns true if a function call or a method call represented by the given span ends with a trailing comma. This function is used when rewriting macro, as adding or removing a trailing comma from macro can potentially break the code.
stmt_is_expr πŸ”’
struct_lit_can_be_aligned πŸ”’
struct_lit_field_separator πŸ”’
to_control_flow πŸ”’
wrap_struct_field πŸ”’