I don't see `pattern` being referenced again, so these two lines are better written as

    let chars = pattern.container_into_owned_bytes();