@@ -359,7 +359,6 @@ crate struct StylePath {
359
359
360
360
thread_local ! ( crate static CURRENT_DEPTH : Cell <usize > = Cell :: new( 0 ) ) ;
361
361
362
- // FIXME: make this work
363
362
crate const INITIAL_IDS : [ & ' static str ; 15 ] = [
364
363
"main" ,
365
364
"search" ,
@@ -4101,7 +4100,7 @@ fn item_typedef(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::T
4101
4100
}
4102
4101
4103
4102
fn item_foreign_type ( w : & mut Buffer , cx : & Context < ' _ > , it : & clean:: Item ) {
4104
- w. write_str ( "<pre class=\" rust foreigntype\" >extern {" ) ;
4103
+ w. write_str ( "<pre class=\" rust foreigntype\" >extern {\n " ) ;
4105
4104
render_attributes ( w, it, false ) ;
4106
4105
write ! (
4107
4106
w,
@@ -4264,8 +4263,8 @@ fn get_methods(
4264
4263
fn small_url_encode ( s : String ) -> String {
4265
4264
let mut st = String :: new ( ) ;
4266
4265
let mut last_match = 0 ;
4267
- for ( idx, c) in s. bytes ( ) . enumerate ( ) {
4268
- let escaped = match c as char {
4266
+ for ( idx, c) in s. char_indices ( ) {
4267
+ let escaped = match c {
4269
4268
'<' => "%3C" ,
4270
4269
'>' => "%3E" ,
4271
4270
' ' => "%20" ,
@@ -4283,6 +4282,8 @@ fn small_url_encode(s: String) -> String {
4283
4282
4284
4283
st += & s[ last_match..idx] ;
4285
4284
st += escaped;
4285
+ // NOTE: we only expect single byte characters here - which is fine as long as we
4286
+ // only match single byte characters
4286
4287
last_match = idx + 1 ;
4287
4288
}
4288
4289
@@ -4834,12 +4835,12 @@ fn item_proc_macro(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, m: &clean
4834
4835
w. push_str ( "<pre class=\" rust derive\" >" ) ;
4835
4836
write ! ( w, "#[derive({})]" , name) ;
4836
4837
if !m. helpers . is_empty ( ) {
4837
- w. push_str ( "\n {" ) ;
4838
- w. push_str ( " // Attributes available to this derive:" ) ;
4838
+ w. push_str ( "\n {\n " ) ;
4839
+ w. push_str ( " // Attributes available to this derive:\n " ) ;
4839
4840
for attr in & m. helpers {
4840
4841
writeln ! ( w, " #[{}]" , attr) ;
4841
4842
}
4842
- w. push_str ( "}" ) ;
4843
+ w. push_str ( "}\n " ) ;
4843
4844
}
4844
4845
w. push_str ( "</pre>" ) ;
4845
4846
}
0 commit comments