Skip to content

Commit

Permalink
Fix paths search
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 5, 2018
1 parent fc6b2c5 commit d0840fd
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/main.js
Expand Up @@ -993,7 +993,7 @@
Math.min(results_returned[fullId].lev, returned);
}
if (index !== -1 || lev <= MAX_LEV_DISTANCE) {
if (index !== -1) {
if (index !== -1 && paths.length < 2) {
lev = 0;
}
if (results[fullId] === undefined) {
Expand Down
18 changes: 18 additions & 0 deletions src/test/rustdoc-js/pinbox-new.js
@@ -0,0 +1,18 @@
// 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 = 'pinbox::new';

const EXPECTED = {
'others': [
{ 'path': 'std::boxed::PinBox', 'name': 'new' },
{ 'path': 'alloc::boxed::PinBox', 'name': 'new' },
],
};
19 changes: 19 additions & 0 deletions src/test/rustdoc-js/vec-new.js
@@ -0,0 +1,19 @@
// 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 = 'Vec::new';

const EXPECTED = {
'others': [
{ 'path': 'std::vec::Vec', 'name': 'new' },
{ 'path': 'std::vec::Vec', 'name': 'ne' },
{ 'path': 'std::boxed::PinBox', 'name': 'new' },
],
};

0 comments on commit d0840fd

Please sign in to comment.