Skip to content

Instantly share code, notes, and snippets.

@steveklabnik
Created November 26, 2014 17:15
Embed
What would you like to do?
/// Literal strings translate to slices into static memory. This is different from
/// trans_slice_vstore() above because it doesn't need to copy the content anywhere.
pub fn trans_lit_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
lit_expr: &ast::Expr,
str_lit: InternedString,
dest: Dest)
-> Block<'blk, 'tcx> {
debug!("trans_lit_str(lit_expr={}, dest={})",
pub fn trans_lit_str<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
lit_expr: &ast::Expr,
str_lit: InternedString,
dest: Dest)
-> Block<'blk, 'tcx> {
/*!
* Literal strings translate to slices into static memory. This is
* different from trans_slice_vstore() above because it doesn't need to copy
* the content anywhere.
*/
debug!("trans_lit_str(lit_expr={}, dest={})",
right now, mostly killing the extra whitespace myself, moving it up, and using visual block to change things
the function isn't guaranteed to be left aligned, it may be indented
The reformatting of the comment is just `V(move)gq`
@espadrine
Copy link

qc/\/\/\/<cr>v/^pub<cr>kd/{$<cr>p+lvlc*!<esc>+<ctrl-v>/^ +[^\/]<cr>kmellc *<esc><backtick>elli/<esc>q or something like that, for a macro named c.

@steveklabnik
Copy link
Author

@espadrine thanks! Now to look at all those chunks and grok them... :)

@nyarly
Copy link

nyarly commented Nov 26, 2014

My muscle memory suggests:

Cursor inside the comment block:

?^\s*\/\/*<enter>  
v
/^\s*\*\/<enter>
:s!\^\(\s*\)\*!\1///!
:'<dd
:'>dd
gv
D
?\<fn\>
]P
k
'[gq

Something like that anyway. When you're building the actual macro, I always like "ap "ad$ (assuming macro is in register a)

@nyarly
Copy link

nyarly commented Nov 26, 2014

I think @espadrine and my suggestions do converse things - his takes the /// comment and makes it a /*, mine might do the reverse. He does include the qc to create the actual macro - I always need to do the edit a few times by hand before I want to do that.

@steveklabnik
Copy link
Author

@nyarly yeah, that seems about right. it is /* -> /// that I want, . regardless, thank you! time to dig in...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment