If T implements Copy then you can use Iterator::copied. Otherwise, if it implements Clone then you can use Iterator::cloned. Like any immutable reference, &str implements both Clone and Copy, so you can use copied:
let hashset: HashSet<&str> = words.iter().copied().collect();