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
40 if loooooooooooooooooooooooooooooooooooooooooong_guard => {}
43 ast::PathParameters::AngleBracketedParameters(ref data)
44 if data.lifetimes.len() > 0 || data.types.len() > 0 || data.bindings.len() > 0 => {}
47 let whatever = match something {
50 // Comment on an attribute.
52 // Comment after an attribute.
59 // Test that a match on an overflow line is laid out properly.
62 match xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {
63 Some(sub_span) => Some(sub_span),
68 // Test that one-line bodies align.
71 Variableeeeeeeeeeeeeeeeee => (
73 vec!["id", "name", "qualname", "value", "type", "scopeid"],
77 Enummmmmmmmmmmmmmmmmmmmm => (
79 vec!["id", "qualname", "scopeid", "value"],
83 Variantttttttttttttttttttttttt => (
85 vec!["id", "name", "qualname", "type", "value", "scopeid"],
92 y => { /*Block with comment. Preserve me.*/ }
111 let _ = match Some(1) {
124 // collapsing here is safe
125 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff => {}
126 // collapsing here exceeds line length
127 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffg => {
130 // comment above block
132 i => {} // comment below block
134 // comment inside block
137 // comments inside...
139 // TODO uncomment when vertical whitespace is handled better
142 // // comment with WS above
145 // // comment with ws below
160 v => {} /* funky block
168 a => println!("a", b),
171 d => println!("a", b),
174 h => println!("a", b), // h comment
175 i => vec![1, 2], // i comment
176 j => vec![3; 4], // j comment
178 k => println!("a", b),
183 // Rewrite splits macro
184 nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn => {
187 // Rewrite splits macro
188 oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => {
191 // Macro support fails to recognise this macro as splittable
192 // We push the whole expr to a new line, TODO split this macro as well
193 pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => {
196 // q, r and s: Rewrite splits match arm
197 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq => {
200 rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr => {
203 ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss => {
206 // Funky bracketing styles
207 t => println!{"a", b},
210 w => println!["a", b],
213 // Brackets with comments
214 tc => println!{"a", b}, // comment
215 uc => vec![1, 2], // comment
216 vc => vec![3; 4], // comment
217 wc => println!["a", b], // comment
218 xc => vec![1, 2], // comment
219 yc => vec![3; 4], // comment
220 yd => looooooooooooooooooooooooooooooooooooooooooooooooooooooooong_func(
232 CompressionMode::DiscardNewline | CompressionMode::CompressWhitespaceNewline => {
235 ast::ItemConst(ref typ, ref expr) => {
236 self.process_static_or_const_item(item, &typ, &expr)
243 match resolution.last_private {
244 LastImport { .. } => false,
251 1 => unsafe { std::intrinsics::abort() },
258 Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
259 HTMLElementTypeId::HTMLCanvasElement,
261 Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
262 HTMLElementTypeId::HTMLObjectElement,
263 ))) => s.has_object_data(),
264 Some(NodeTypeId::Element(_)) => false,
273 def::DefConst(def_id) | def::DefAssociatedConst(def_id) => {
274 match const_eval::lookup_const_by_id(cx.tcx, def_id, Some(self.pat.id)) {
275 Some(const_expr) => x,
287 hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => {
288 result.push(StmtRef::Mirror(Box::new(Stmt {
290 kind: StmtKind::Expr {
291 scope: cx.tcx.region_maps.node_extent(id),
302 BiEq | BiLt | BiLe | BiNe | BiGt | BiGe => true,
303 BiAnd | BiOr | BiAdd | BiSub | BiMul | BiDiv | BiRem | BiBitXor | BiBitAnd | BiBitOr
304 | BiShl | BiShr => false,
310 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
311 if foooooooooooooo && barrrrrrrrrrrr => {}
312 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
313 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
314 if foooooooooooooo && barrrrrrrrrrrr => {}
315 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
316 if fooooooooooooooooooooo
317 && (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
318 || cccccccccccccccccccccccccccccccccccccccc) => {}
324 sfEvtClosed => Closed,
326 let e = unsafe { *event.size.as_ref() };
333 sfEvtLostFocus => LostFocus,
334 sfEvtGainedFocus => GainedFocus,
335 sfEvtTextEntered => TextEntered {
337 ::std::char::from_u32((*event.text.as_ref()).unicode)
338 .expect("Invalid unicode encountered on TextEntered event")
342 let e = unsafe { event.key.as_ref() };
345 code: unsafe { ::std::mem::transmute(e.code) },
346 alt: e.alt.to_bool(),
347 ctrl: e.control.to_bool(),
348 shift: e.shift.to_bool(),
349 system: e.system.to_bool(),
352 sfEvtKeyReleased => {
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(),
367 let bar = Some(true);
368 let foo = Some(true);
370 bar.and_then(|_| match foo {
381 artists: match reader.evaluate(".//mb:recording/mb:artist-credit/mb:name-credit")? {
382 Nodeset(nodeset) => {
383 let res: Result<Vec<ArtistRef>, ReadError> = nodeset
386 XPathNodeReader::new(node, &context).and_then(|r| ArtistRef::from_xml(&r))
398 REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT => {
399 "internal_spec_insert_internal_spec_insert_internal_spec_insert"
401 _ => "reorder_something",
410 TaskState::Started => "started",
411 TaskState::Success => "success",
412 TaskState::Failed => "failed",
418 fn match_with_near_max_width() {
419 let (this_line_uses_99_characters_and_is_formatted_properly, x012345) = match some_expression {
420 _ => unimplemented!(),
423 let (should_be_formatted_like_the_line_above_using_100_characters, x0) = match some_expression {
424 _ => unimplemented!(),
427 let (should_put_the_brace_on_the_next_line_using_101_characters, x0000) = match some_expression
429 _ => unimplemented!(),
437 | Variant::Tag6 => {}
441 fn match_with_trailing_spaces() {
443 #![allow(simple_match)]
457 impl<'tcx> Const<'tcx> {
458 pub fn from_constval<'a>() -> Const<'tcx> {
459 let val = match *cv {
460 ConstVal::Variant(_) | ConstVal::Aggregate(..) | ConstVal::Unevaluated(..) => bug!(
461 "MIR must not use `{:?}` (aggregates are expanded to MIR rvalues)",
479 "aaaaaaaaaaaaa" | "bbbbbbbbbbbbb" | "cccccccccccccccccccccccccccccccccccccccccccc"
481 "bind" | "writev" | "readv" | "sendmsg" | "recvmsg" if android && (aarch64 || x86_64) => {