We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42e5468 commit b3ca3cdCopy full SHA for b3ca3cd
crates/snapbox/src/data/source.rs
@@ -102,17 +102,20 @@ impl Inline {
102
}
103
104
fn trimmed(&self) -> String {
105
- if !self.data.contains('\n') {
106
- return self.data.to_string();
+ let mut data = self.data;
+ if data.contains('\n') {
107
+ if data.starts_with('\n') {
108
+ data = &data[1..]
109
+ }
110
+ if self.indent {
111
+ return trim_indent(data);
112
113
- trim_indent(self.data)
114
+ data.to_owned()
115
116
117
-fn trim_indent(mut text: &str) -> String {
- if text.starts_with('\n') {
- text = &text[1..];
- }
118
+fn trim_indent(text: &str) -> String {
119
let indent = text
120
.lines()
121
.filter(|it| !it.trim().is_empty())
0 commit comments