]>
git.proxmox.com Git - rustc.git/blob - src/test/rustdoc-json/lifetime/longest.rs
1 // ignore-tidy-linelength
6 // @is "$.index[*][?(@.name=='longest')].inner.generics.params[0].name" \"\'a\"
7 // @is "$.index[*][?(@.name=='longest')].inner.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
8 // @is "$.index[*][?(@.name=='longest')].inner.generics.params[0].kind" '{"lifetime": {"outlives": []}}'
9 // @count "$.index[*][?(@.name=='longest')].inner.generics.params[*]" 1
10 // @is "$.index[*][?(@.name=='longest')].inner.generics.where_predicates" []
12 // @count "$.index[*][?(@.name=='longest')].inner.decl.inputs[*]" 2
13 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[0][0]" '"l"'
14 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[1][0]" '"r"'
16 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[0][1].kind" '"borrowed_ref"'
17 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[0][1].inner.lifetime" \"\'a\"
18 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[0][1].inner.mutable" false
19 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[0][1].inner.type" '{"inner": "str", "kind": "primitive"}'
21 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[1][1].kind" '"borrowed_ref"'
22 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[1][1].inner.lifetime" \"\'a\"
23 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[1][1].inner.mutable" false
24 // @is "$.index[*][?(@.name=='longest')].inner.decl.inputs[1][1].inner.type" '{"inner": "str", "kind": "primitive"}'
26 // @is "$.index[*][?(@.name=='longest')].inner.decl.output.kind" '"borrowed_ref"'
27 // @is "$.index[*][?(@.name=='longest')].inner.decl.output.inner.lifetime" \"\'a\"
28 // @is "$.index[*][?(@.name=='longest')].inner.decl.output.inner.mutable" false
29 // @is "$.index[*][?(@.name=='longest')].inner.decl.output.inner.type" '{"inner": "str", "kind": "primitive"}'
31 pub fn longest
<'a
>(l
: &'a
str, r
: &'a
str) -> &'a
str {
32 if l
.len() > r
.len() { l }
else { r }