Fix quoted search
This commit is contained in:
parent
fdc18b3067
commit
7cc3cb29bd
2 changed files with 25 additions and 2 deletions
|
|
@ -600,7 +600,7 @@
|
|||
var lev_distance = MAX_LEV_DISTANCE + 1;
|
||||
if (obj.name === val.name) {
|
||||
if (literalSearch === true) {
|
||||
if (val.generics.length !== 0) {
|
||||
if (val.generics && val.generics.length !== 0) {
|
||||
if (obj.generics && obj.length >= val.generics.length) {
|
||||
var elems = obj.generics.slice(0);
|
||||
var allFound = true;
|
||||
|
|
@ -637,7 +637,7 @@
|
|||
}
|
||||
// Names didn't match so let's check if one of the generic types could.
|
||||
if (literalSearch === true) {
|
||||
if (obj.generics.length > 0) {
|
||||
if (obj.generics && obj.generics.length > 0) {
|
||||
for (var x = 0; x < obj.generics.length; ++x) {
|
||||
if (obj.generics[x] === val.name) {
|
||||
return true;
|
||||
|
|
|
|||
23
src/test/rustdoc-js/quoted.js
Normal file
23
src/test/rustdoc-js/quoted.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const QUERY = '"error"';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'error' },
|
||||
{ 'path': 'std::fmt', 'name': 'Error' },
|
||||
{ 'path': 'std::io', 'name': 'Error' },
|
||||
],
|
||||
'in_args': [],
|
||||
'returned': [
|
||||
{ 'path': 'std::fmt::LowerExp', 'name': 'fmt' },
|
||||
],
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue