Use &str instead of ~str for task_name argument

Addresses review comments from pcwalton.