- pub fn snippet(&self, span: Span) -> String {
- self.codemap.span_to_snippet(span).unwrap()
+ pub fn snippet(&self, span: Span) -> &str {
+ self.snippet_provider.span_to_snippet(span).unwrap()
+ }
+
+ /// Return true if we should use block indent style for rewriting function call.
+ pub fn use_block_indent(&self) -> bool {
+ self.config.indent_style() == IndentStyle::Block || *self.use_block.borrow()
+ }
+
+ pub fn budget(&self, used_width: usize) -> usize {
+ self.config.max_width().saturating_sub(used_width)
+ }
+
+ pub fn inside_macro(&self) -> bool {
+ *self.inside_macro.borrow()
+ }
+
+ pub fn is_if_else_block(&self) -> bool {
+ *self.is_if_else_block.borrow()