1 // rustfmt-normalize_comments: true
17 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
19 Pattern1 | Pattern2 | Pattern3 => false,
20 Paternnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn |
21 Paternnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn => blah,
22 Patternnnnnnnnnnnnnnnnnnn |
23 Patternnnnnnnnnnnnnnnnnnn |
24 Patternnnnnnnnnnnnnnnnnnn |
25 Patternnnnnnnnnnnnnnnnnnn => meh,
27 Patternnnnnnnnnnnnnnnnnnn | Patternnnnnnnnnnnnnnnnnnn if looooooooooooooooooong_guard => {
31 Patternnnnnnnnnnnnnnnnnnnnnnnnn | Patternnnnnnnnnnnnnnnnnnnnnnnnn
32 if looooooooooooooooooooooooooooooooooooooooong_guard =>
37 // Test that earlier patterns can take the guard space
38 (aaaa, bbbbb, ccccccc, aaaaa, bbbbbbbb, cccccc, aaaa, bbbbbbbb, cccccc, dddddd) |
39 Patternnnnnnnnnnnnnnnnnnnnnnnnn if loooooooooooooooooooooooooooooooooooooooooong_guard => {}
42 ast::PathParameters::AngleBracketedParameters(ref data)
43 if data.lifetimes.len() > 0 || data.types.len() > 0 || data.bindings.len() > 0 => {}
46 let whatever = match something {
49 // Comment on an attribute.
51 // Comment after an attribute.
58 // Test that a match on an overflow line is laid out properly.
61 match xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {
62 Some(sub_span) => Some(sub_span),
67 // Test that one-line bodies align.
70 Variableeeeeeeeeeeeeeeeee => (
72 vec!["id", "name", "qualname", "value", "type", "scopeid"],
76 Enummmmmmmmmmmmmmmmmmmmm => (
78 vec!["id", "qualname", "scopeid", "value"],
82 Variantttttttttttttttttttttttt => (
84 vec!["id", "name", "qualname", "type", "value", "scopeid"],
91 y => { /*Block with comment. Preserve me.*/ }
110 let _ = match Some(1) {
123 // collapsing here is safe
124 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff => {}
125 // collapsing here exceeds line length
126 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffg => {
129 // comment above block
132 // comment below block
134 // comment inside block
137 // comments inside...
140 // TODO uncomment when vertical whitespace is handled better
143 // // comment with WS above
146 // // comment with ws below
161 v => {} /* funky block
169 a => println!("a", b),
172 d => println!("a", b),
175 h => println!("a", b), // h comment
176 i => vec![1, 2], // i comment
177 j => vec![3; 4], // j comment
179 k => println!("a", b),
184 // Rewrite splits macro
185 nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn => {
188 // Rewrite splits macro
189 oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => {
192 // Macro support fails to recognise this macro as splitable
193 // We push the whole expr to a new line, TODO split this macro as well
194 pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => {
197 // q, r and s: Rewrite splits match arm
198 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq => {
201 rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr => {
204 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss => {
207 // Funky bracketing styles
208 t => println!{"a", b},
211 w => println!["a", b],
214 // Brackets with comments
215 tc => println!{"a", b}, // comment
216 uc => vec![1, 2], // comment
217 vc => vec![3; 4], // comment
218 wc => println!["a", b], // comment
219 xc => vec![1, 2], // comment
220 yc => vec![3; 4], // comment
221 yd => looooooooooooooooooooooooooooooooooooooooooooooooooooooooong_func(
233 CompressionMode::DiscardNewline | CompressionMode::CompressWhitespaceNewline => {
236 ast::ItemConst(ref typ, ref expr) => {
237 self.process_static_or_const_item(item, &typ, &expr)
244 match resolution.last_private {
245 LastImport { .. } => false,
252 1 => unsafe { std::intrinsics::abort() },
260 NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)),
263 NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)),
264 ) => s.has_object_data(),
265 Some(NodeTypeId::Element(_)) => false,
274 def::DefConst(def_id) | def::DefAssociatedConst(def_id) => {
275 match const_eval::lookup_const_by_id(cx.tcx, def_id, Some(self.pat.id)) {
276 Some(const_expr) => x,
288 hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => {
289 result.push(StmtRef::Mirror(Box::new(Stmt {
291 kind: StmtKind::Expr {
292 scope: cx.tcx.region_maps.node_extent(id),
303 BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true,
321 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
322 if foooooooooooooo && barrrrrrrrrrrr => {}
323 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
324 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
325 if foooooooooooooo && barrrrrrrrrrrr => {}
326 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
327 if fooooooooooooooooooooo &&
328 (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ||
329 cccccccccccccccccccccccccccccccccccccccc) => {}
335 sfEvtClosed => Closed,
337 let e = unsafe { *event.size.as_ref() };
344 sfEvtLostFocus => LostFocus,
345 sfEvtGainedFocus => GainedFocus,
346 sfEvtTextEntered => TextEntered {
348 ::std::char::from_u32((*event.text.as_ref()).unicode)
349 .expect("Invalid unicode encountered on TextEntered event")
353 let e = unsafe { event.key.as_ref() };
356 code: unsafe { ::std::mem::transmute(e.code) },
357 alt: e.alt.to_bool(),
358 ctrl: e.control.to_bool(),
359 shift: e.shift.to_bool(),
360 system: e.system.to_bool(),
363 sfEvtKeyReleased => {
364 let e = unsafe { event.key.as_ref() };
367 code: unsafe { ::std::mem::transmute(e.code) },
368 alt: e.alt.to_bool(),
369 ctrl: e.control.to_bool(),
370 shift: e.shift.to_bool(),
371 system: e.system.to_bool(),
378 let bar = Some(true);
379 let foo = Some(true);
381 bar.and_then(|_| match foo {
392 artists: match reader.evaluate(".//mb:recording/mb:artist-credit/mb:name-credit")? {
393 Nodeset(nodeset) => {
394 let res: Result<Vec<ArtistRef>, ReadError> = nodeset
397 XPathNodeReader::new(node, &context).and_then(|r| ArtistRef::from_xml(&r))
409 REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT => {
410 "internal_spec_insert_internal_spec_insert_internal_spec_insert"
412 _ => "reorder_something",
421 TaskState::Started => "started",
422 TaskState::Success => "success",
423 TaskState::Failed => "failed",
429 fn match_with_near_max_width() {
430 let (this_line_uses_99_characters_and_is_formatted_properly, x012345) = match some_expression {
431 _ => unimplemented!(),
434 let (should_be_formatted_like_the_line_above_using_100_characters, x0) = match some_expression {
435 _ => unimplemented!(),
438 let (should_put_the_brace_on_the_next_line_using_101_characters, x0000) = match some_expression
440 _ => unimplemented!(),
452 fn match_with_trailing_spaces() {
454 #![allow(simple_match)]