Skip to content

Commit

Permalink
Simplify logic in set_fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
yescallop committed Oct 12, 2024
1 parent 05d4ad6 commit 6b27786
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,8 @@ impl<'v, 'm> Ref<'v, 'm> {

pub fn set_fragment(buf: &mut String, meta: &Meta, opt: Option<&str>) {
buf.truncate(meta.query_or_path_end());
buf.reserve_exact(opt.map_or(0, |s| s.len() + 1));
if let Some(s) = opt {
buf.reserve(s.len() + 1);
buf.push('#');
buf.push_str(s);
}
Expand Down

0 comments on commit 6b27786

Please sign in to comment.