diff options
| author | Teddy Wing | 2021-07-09 21:34:50 +0200 |
|---|---|---|
| committer | Teddy Wing | 2021-07-09 21:34:50 +0200 |
| commit | 16a7c3136b1dffd3d3b44624642acc681bb8b08b (patch) | |
| tree | 87d9fe504bd02461dc4b134057aa2953fb98d96d /src/main.rs | |
| parent | a94ccb468515d770491bd0df3368cb18b5a35947 (diff) | |
| download | google-calendar-rsvp-16a7c3136b1dffd3d3b44624642acc681bb8b08b.tar.bz2 | |
This blog post by Dimitri Merejkowsky clued me into the fact that I had
incorrectly ignored a compiler warning about an unused assignment:
https://dmerej.info/blog/post/awesome-rust-warnings/#the-useless-mutation
When I wrote that line, I didn't realise you could declare an
uninitialised variable, and definitely didn't get what the compiler
meant when it told me:
warning: value assigned to `email_eid` is never read
--> src/main.rs:102:9
|
102 | let mut email_eid = String::new();
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_assignments)]` on by default
= help: maybe it is overwritten before being read?
so I ignored the warning.
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 3d508f7..88d6ec3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,9 +99,7 @@ async fn run() -> anyhow::Result<()> { let mut action_opt: Option<EventResponseStatus> = None; let mut should_read_email = false; - - #[allow(unused_assignments)] - let mut email_eid = String::new(); + let email_eid; let mut event_ids = Vec::new(); let mut is_verbose = false; |
