diff --git a/lib/docs/filters/rust/clean_html.rb b/lib/docs/filters/rust/clean_html.rb
index 2c062eda..db07a9ed 100644
--- a/lib/docs/filters/rust/clean_html.rb
+++ b/lib/docs/filters/rust/clean_html.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Docs
class Rust
class CleanHtmlFilter < Filter
@@ -74,10 +76,10 @@ module Docs
node.remove
end
- css('h2 .important-traits', 'h3 .important-traits', 'h4 .important-traits').each do |node|
+ css('.important-traits').to_a.each_with_index do |node, index|
content = node.at_css('.content.hidden .content')
node.at_css('.content.hidden').replace(content) if content
- node.parent.after(node)
+ node.parent.after(node) if node.parent.name.in?(%(h2 h3 h4))
end
css('code.content').each do |node|
diff --git a/lib/docs/filters/rust/entries.rb b/lib/docs/filters/rust/entries.rb
index eb427eba..524342fc 100644
--- a/lib/docs/filters/rust/entries.rb
+++ b/lib/docs/filters/rust/entries.rb
@@ -43,13 +43,12 @@ module Docs
end
else
css('.method')
- .select {|node| !node.at_css('.fnname').nil?}
- .map {|node|
- name = node.at_css('.fnname').content
+ .each_with_object({}) { |node, entries|
+ name = node.at_css('.fnname').try(:content)
+ next unless name
name.prepend "#{self.name}::"
- [name, node['id']]
- }
- .uniq {|item| item[0]}
+ entries[name] ||= [name, node['id']]
+ }.values
end
end
end
diff --git a/lib/docs/scrapers/rust.rb b/lib/docs/scrapers/rust.rb
index d960c42b..1677e138 100644
--- a/lib/docs/scrapers/rust.rb
+++ b/lib/docs/scrapers/rust.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
module Docs
class Rust < UrlScraper
self.type = 'rust'
- self.release = '1.29.1'
+ self.release = '1.30.1'
self.base_url = 'https://doc.rust-lang.org/'
self.root_path = 'book/second-edition/index.html'
self.initial_paths = %w(
@@ -28,6 +30,7 @@ module Docs
options[:fix_urls] = ->(url) do
url.sub! %r{(#{Rust.base_url}.+/)\z}, '\1index.html'
url.sub! '/unicode/u_str', '/unicode/str/'
+ url.sub! '/std/std/', '/std/'
url
end