Skip to content

Commit 654cb84

Browse files
Add specific never search
1 parent d2577ca commit 654cb84

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/librustdoc/html/static/main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,11 @@
10621062
type = matches[1].replace(/^const$/, 'constant');
10631063
query = query.substring(matches[0].length);
10641064
}
1065+
// In case we just get a '!' as input, we can assume that the user is looking for the
1066+
// `Never` primitive type.
1067+
if (raw === '!') {
1068+
query = 'Never';
1069+
}
10651070

10661071
return {
10671072
raw: raw,
@@ -1369,7 +1374,7 @@
13691374

13701375
function search(e) {
13711376
var params = getQueryStringParams();
1372-
var query = getQuery(document.getElementsByClassName('search-input')[0].value);
1377+
var query = getQuery(document.getElementsByClassName('search-input')[0].value.trim());
13731378

13741379
if (e) {
13751380
e.preventDefault();

src/test/rustdoc-js/never.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
const QUERY = '!';
12+
13+
const EXPECTED = {
14+
'others': [
15+
{ 'path': 'std', 'name': 'never' },
16+
],
17+
};

0 commit comments

Comments
 (0)