changeset 38:34c794d4ca3a

Suppress warnings selectively
author Lewin Bormann <lbo@spheniscida.de>
date Mon, 19 Oct 2020 10:44:17 +0200
parents 77c979f1c242
children 76c6fd46ab10
files drive_example/src/drive_v3_types.rs drive_example/src/main.rs generate/templates.py
diffstat 3 files changed, 474 insertions(+), 346 deletions(-) [+]
line wrap: on
line diff
--- a/drive_example/src/drive_v3_types.rs	Mon Oct 19 10:24:43 2020 +0200
+++ b/drive_example/src/drive_v3_types.rs	Mon Oct 19 10:44:17 2020 +0200
@@ -1,5 +1,5 @@
 
-#![allow_unused]
+#![allow(unused_variables, unused_mut, dead_code)]
 //! This file was generated by async-google-apis. (https://github.com/dermesser/async-google-apis)
 //!
 //! (c) 2020 Lewin Bormann <lbo@spheniscida.de>
@@ -12,7 +12,7 @@
 use chrono::{DateTime, Utc};
 use anyhow::{Error, Result};
 use std::collections::HashMap;
-use tokio::stream::{Stream, StreamExt};
+use tokio::stream::StreamExt;
 use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
 
 pub type TlsConnr = hyper_rustls::HttpsConnector<hyper::client::HttpConnector>;
@@ -2375,9 +2375,9 @@
 
     let rel_path = format!("about", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -2385,8 +2385,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -2402,8 +2404,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2438,9 +2440,9 @@
 
     let rel_path = format!("changes/startPageToken", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -2448,8 +2450,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.drive_id {
         url_params.push_str(&format!("&driveId={}",
@@ -2481,8 +2485,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2493,9 +2497,9 @@
 
     let rel_path = format!("changes", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -2503,8 +2507,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.drive_id {
         url_params.push_str(&format!("&driveId={}",
@@ -2570,8 +2576,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2582,9 +2588,9 @@
 
     let rel_path = format!("changes/watch", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -2592,8 +2598,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.drive_id {
         url_params.push_str(&format!("&driveId={}",
@@ -2664,8 +2672,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2700,9 +2708,9 @@
 
     let rel_path = format!("channels/stop", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -2710,8 +2718,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -2732,8 +2742,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2768,13 +2778,15 @@
 
     let rel_path = format!("files/{fileId}/comments", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -2795,8 +2807,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2807,13 +2819,15 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}", fileId=params.file_id,commentId=params.comment_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -2829,8 +2843,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2841,14 +2855,16 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}", fileId=params.file_id,commentId=params.comment_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.include_deleted {
         url_params.push_str(&format!("&includeDeleted={}",
@@ -2868,8 +2884,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2880,14 +2896,16 @@
 
     let rel_path = format!("files/{fileId}/comments", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.include_deleted {
         url_params.push_str(&format!("&includeDeleted={}",
@@ -2919,8 +2937,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2931,13 +2949,15 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}", fileId=params.file_id,commentId=params.comment_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -2958,8 +2978,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -2994,12 +3014,14 @@
 
     let rel_path = format!("drives", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     url_params.push_str(&format!("&requestId={}",
         percent_encode(format!("{}", params.request_id).as_bytes(), NON_ALPHANUMERIC).to_string()));
@@ -3022,8 +3044,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3034,12 +3056,14 @@
 
     let rel_path = format!("drives/{driveId}", driveId=params.drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -3055,8 +3079,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3067,13 +3091,15 @@
 
     let rel_path = format!("drives/{driveId}", driveId=params.drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.use_domain_admin_access {
         url_params.push_str(&format!("&useDomainAdminAccess={}",
@@ -3093,8 +3119,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3105,12 +3131,14 @@
 
     let rel_path = format!("drives/{driveId}/hide", driveId=params.drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -3126,8 +3154,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3138,13 +3166,15 @@
 
     let rel_path = format!("drives", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.page_size {
         url_params.push_str(&format!("&pageSize={}",
@@ -3176,8 +3206,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3188,12 +3218,14 @@
 
     let rel_path = format!("drives/{driveId}/unhide", driveId=params.drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -3209,8 +3241,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3221,12 +3253,14 @@
 
     let rel_path = format!("drives/{driveId}", driveId=params.drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.use_domain_admin_access {
         url_params.push_str(&format!("&useDomainAdminAccess={}",
@@ -3251,8 +3285,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3287,15 +3321,17 @@
 
     let rel_path = format!("files/{fileId}/copy", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.enforce_single_parent {
         url_params.push_str(&format!("&enforceSingleParent={}",
@@ -3344,8 +3380,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3356,14 +3392,16 @@
 
     let rel_path = format!("files", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.enforce_single_parent {
         url_params.push_str(&format!("&enforceSingleParent={}",
@@ -3416,8 +3454,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3427,7 +3465,17 @@
     &mut self, params: &FilesCreateParams, data: hyper::body::Bytes) -> Result<File> {
     let rel_path = "upload/drive/v3/files";
     let path = "https://www.googleapis.com/".to_string() + &rel_path;
-    let tok = self.authenticator.token(&self.scopes).await?;
+
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
+        "https://www.googleapis.com/auth/drive.appdata".to_string(),
+        "https://www.googleapis.com/auth/drive.file".to_string(),
+        ];
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?uploadType=media&oauth_token={token}&fields=*", token=tok.as_str());
 
     if let Some(ref val) = &params.enforce_single_parent {
@@ -3475,8 +3523,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3487,14 +3535,16 @@
 
     let rel_path = format!("files/{fileId}", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.enforce_single_parent {
         url_params.push_str(&format!("&enforceSingleParent={}",
@@ -3522,8 +3572,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3534,12 +3584,14 @@
 
     let rel_path = format!("files/trash", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.enforce_single_parent {
         url_params.push_str(&format!("&enforceSingleParent={}",
@@ -3559,26 +3611,29 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
 
 /// Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.
 pub async fn export(
-    &mut self, params: &FilesExportParams,  dst: &mut std::io::Write) -> Result<()> {
+    &mut self, params: &FilesExportParams,  dst: &mut dyn std::io::Write) -> Result<()> {
 
     let rel_path = format!("files/trash", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     url_params.push_str(&format!("&mimeType={}",
         percent_encode(format!("{}", params.mime_type).as_bytes(), NON_ALPHANUMERIC).to_string()));
@@ -3615,14 +3670,16 @@
 
     let rel_path = format!("files/generateIds", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.count {
         url_params.push_str(&format!("&count={}",
@@ -3646,8 +3703,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3658,9 +3715,9 @@
 
     let rel_path = format!("files/{fileId}", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -3668,8 +3725,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.acknowledge_abuse {
         url_params.push_str(&format!("&acknowledgeAbuse={}",
@@ -3701,8 +3760,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3713,9 +3772,9 @@
 
     let rel_path = format!("files", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -3723,8 +3782,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.corpora {
         url_params.push_str(&format!("&corpora={}",
@@ -3796,8 +3857,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3808,16 +3869,18 @@
 
     let rel_path = format!("files/{fileId}", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
         "https://www.googleapis.com/auth/drive.scripts".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.add_parents {
         url_params.push_str(&format!("&addParents={}",
@@ -3874,8 +3937,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3885,7 +3948,19 @@
     &mut self, params: &FilesUpdateParams, data: hyper::body::Bytes) -> Result<File> {
     let rel_path = "upload/drive/v3/files/{fileId}";
     let path = "https://www.googleapis.com/".to_string() + &rel_path;
-    let tok = self.authenticator.token(&self.scopes).await?;
+
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
+        "https://www.googleapis.com/auth/drive.appdata".to_string(),
+        "https://www.googleapis.com/auth/drive.file".to_string(),
+        "https://www.googleapis.com/auth/drive.metadata".to_string(),
+        "https://www.googleapis.com/auth/drive.scripts".to_string(),
+        ];
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?uploadType=media&oauth_token={token}&fields=*", token=tok.as_str());
 
     if let Some(ref val) = &params.add_parents {
@@ -3937,8 +4012,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -3949,9 +4024,9 @@
 
     let rel_path = format!("files/{fileId}/watch", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -3959,8 +4034,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.acknowledge_abuse {
         url_params.push_str(&format!("&acknowledgeAbuse={}",
@@ -3997,8 +4074,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4033,13 +4110,15 @@
 
     let rel_path = format!("files/{fileId}/permissions", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.email_message {
         url_params.push_str(&format!("&emailMessage={}",
@@ -4092,8 +4171,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4104,13 +4183,15 @@
 
     let rel_path = format!("files/{fileId}/permissions/{permissionId}", fileId=params.file_id,permissionId=params.permission_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.supports_all_drives {
         url_params.push_str(&format!("&supportsAllDrives={}",
@@ -4138,8 +4219,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4150,17 +4231,19 @@
 
     let rel_path = format!("files/{fileId}/permissions/{permissionId}", fileId=params.file_id,permissionId=params.permission_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
         "https://www.googleapis.com/auth/drive.metadata.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.supports_all_drives {
         url_params.push_str(&format!("&supportsAllDrives={}",
@@ -4188,8 +4271,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4200,17 +4283,19 @@
 
     let rel_path = format!("files/{fileId}/permissions", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
         "https://www.googleapis.com/auth/drive.metadata.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.include_permissions_for_view {
         url_params.push_str(&format!("&includePermissionsForView={}",
@@ -4250,8 +4335,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4262,13 +4347,15 @@
 
     let rel_path = format!("files/{fileId}/permissions/{permissionId}", fileId=params.file_id,permissionId=params.permission_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.remove_expiration {
         url_params.push_str(&format!("&removeExpiration={}",
@@ -4309,8 +4396,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4345,13 +4432,15 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}/replies", fileId=params.file_id,commentId=params.comment_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -4372,8 +4461,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4384,13 +4473,15 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}/replies/{replyId}", fileId=params.file_id,commentId=params.comment_id,replyId=params.reply_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -4406,8 +4497,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4418,14 +4509,16 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}/replies/{replyId}", fileId=params.file_id,commentId=params.comment_id,replyId=params.reply_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.include_deleted {
         url_params.push_str(&format!("&includeDeleted={}",
@@ -4445,8 +4538,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4457,14 +4550,16 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}/replies", fileId=params.file_id,commentId=params.comment_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.include_deleted {
         url_params.push_str(&format!("&includeDeleted={}",
@@ -4492,8 +4587,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4504,13 +4599,15 @@
 
     let rel_path = format!("files/{fileId}/comments/{commentId}/replies/{replyId}", fileId=params.file_id,commentId=params.comment_id,replyId=params.reply_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -4531,8 +4628,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4567,14 +4664,16 @@
 
     let rel_path = format!("files/{fileId}/revisions/{revisionId}", fileId=params.file_id,revisionId=params.revision_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -4590,8 +4689,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4602,9 +4701,9 @@
 
     let rel_path = format!("files/{fileId}/revisions/{revisionId}", fileId=params.file_id,revisionId=params.revision_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -4612,8 +4711,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.acknowledge_abuse {
         url_params.push_str(&format!("&acknowledgeAbuse={}",
@@ -4633,8 +4734,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4645,9 +4746,9 @@
 
     let rel_path = format!("files/{fileId}/revisions", fileId=params.file_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         "https://www.googleapis.com/auth/drive.metadata".to_string(),
@@ -4655,8 +4756,10 @@
         "https://www.googleapis.com/auth/drive.photos.readonly".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.page_size {
         url_params.push_str(&format!("&pageSize={}",
@@ -4680,8 +4783,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4692,14 +4795,16 @@
 
     let rel_path = format!("files/{fileId}/revisions/{revisionId}", fileId=params.file_id,revisionId=params.revision_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.appdata".to_string(),
         "https://www.googleapis.com/auth/drive.file".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -4720,8 +4825,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4756,12 +4861,14 @@
 
     let rel_path = format!("teamdrives", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     url_params.push_str(&format!("&requestId={}",
         percent_encode(format!("{}", params.request_id).as_bytes(), NON_ALPHANUMERIC).to_string()));
@@ -4784,8 +4891,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4796,12 +4903,14 @@
 
     let rel_path = format!("teamdrives/{teamDriveId}", teamDriveId=params.team_drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
 
     let full_uri = path + &url_params;
@@ -4817,8 +4926,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4829,13 +4938,15 @@
 
     let rel_path = format!("teamdrives/{teamDriveId}", teamDriveId=params.team_drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.use_domain_admin_access {
         url_params.push_str(&format!("&useDomainAdminAccess={}",
@@ -4855,8 +4966,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4867,13 +4978,15 @@
 
     let rel_path = format!("teamdrives", );
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         "https://www.googleapis.com/auth/drive.readonly".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.page_size {
         url_params.push_str(&format!("&pageSize={}",
@@ -4905,8 +5018,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
@@ -4917,12 +5030,14 @@
 
     let rel_path = format!("teamdrives/{teamDriveId}", teamDriveId=params.team_drive_id);
     let path = "https://www.googleapis.com/drive/v3/".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec!["https://www.googleapis.com/auth/drive".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &["https://www.googleapis.com/auth/drive".to_string(),
         ];
-    }
-    let tok = self.authenticator.token(&self.scopes).await?;
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     if let Some(ref val) = &params.use_domain_admin_access {
         url_params.push_str(&format!("&useDomainAdminAccess={}",
@@ -4947,8 +5062,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 
--- a/drive_example/src/main.rs	Mon Oct 19 10:24:43 2020 +0200
+++ b/drive_example/src/main.rs	Mon Oct 19 10:44:17 2020 +0200
@@ -79,7 +79,7 @@
 
     let scopes = vec![drive::DriveScopes::DriveFile];
     let mut cl = drive::FilesService::new(https, Rc::new(auth));
-    cl.set_scopes(scopes);
+    cl.set_scopes(&scopes);
 
     let arg = std::env::args().skip(1).next();
     if let Some(fp) = arg {
--- a/generate/templates.py	Mon Oct 19 10:24:43 2020 +0200
+++ b/generate/templates.py	Mon Oct 19 10:44:17 2020 +0200
@@ -1,6 +1,6 @@
 # General imports and error type.
 RustHeader = '''
-#![allow_unused]
+#![allow(unused_variables, unused_mut, dead_code)]
 //! This file was generated by async-google-apis. (https://github.com/dermesser/async-google-apis)
 //!
 //! (c) 2020 Lewin Bormann <lbo@spheniscida.de>
@@ -13,7 +13,7 @@
 use chrono::{DateTime, Utc};
 use anyhow::{Error, Result};
 use std::collections::HashMap;
-use tokio::stream::{Stream, StreamExt};
+use tokio::stream::StreamExt;
 use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
 
 pub type TlsConnr = hyper_rustls::HttpsConnector<hyper::client::HttpConnector>;
@@ -125,12 +125,14 @@
 
     let rel_path = {{{rel_path_expr}}};
     let path = "{{{base_path}}}".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec![{{#scopes}}"{{{scope}}}".to_string(),
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &[{{#scopes}}"{{{scope}}}".to_string(),
         {{/scopes}}];
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
     }
-    let tok = self.authenticator.token(&self.scopes).await?;
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     {{#params}}
     if let Some(ref val) = &params.{{{snake_param}}} {
@@ -163,8 +165,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 '''
@@ -180,7 +182,15 @@
     &mut self, params: &{{{param_type}}}, data: hyper::body::Bytes) -> Result<{{out_type}}> {
     let rel_path = {{{rel_path_expr}}};
     let path = "{{{base_path}}}".to_string() + &rel_path;
-    let tok = self.authenticator.token(&self.scopes).await?;
+
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &[{{#scopes}}"{{{scope}}}".to_string(),
+        {{/scopes}}];
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
+    }
     let mut url_params = format!("?uploadType=media&oauth_token={token}&fields=*", token=tok.as_str());
 
     {{#params}}
@@ -206,8 +216,8 @@
         return Err(anyhow::Error::new(ApiError::HTTPError(resp.status())));
     }
     let resp_body = hyper::body::to_bytes(resp.into_body()).await?;
-    let bodystr = String::from_utf8(resp_body.to_vec())?;
-    let decoded = serde_json::from_str(&bodystr)?;
+    let resp_body_str = String::from_utf8(resp_body.to_vec())?;
+    let decoded = serde_json::from_str(&resp_body_str)?;
     Ok(decoded)
   }
 '''
@@ -220,16 +230,19 @@
 DownloadMethodTmpl = '''
 /// {{{description}}}
 pub async fn {{{name}}}(
-    &mut self, params: &{{{param_type}}}, {{#in_type}}{{{in_type}}},{{/in_type}} dst: &mut std::io::Write) -> Result<{{out_type}}> {
+    &mut self, params: &{{{param_type}}}, {{#in_type}}{{{in_type}}},{{/in_type}} dst: &mut dyn std::io::Write) -> Result<{{out_type}}> {
 
     let rel_path = {{{rel_path_expr}}};
     let path = "{{{base_path}}}".to_string() + &rel_path;
-    let mut scopes = &self.scopes;
-    if scopes.is_empty() {
-        scopes = &vec![{{#scopes}}"{{{scope}}}".to_string(),
+
+    let tok;
+    if self.scopes.is_empty() {
+        let scopes = &[{{#scopes}}"{{{scope}}}".to_string(),
         {{/scopes}}];
+        tok = self.authenticator.token(scopes).await?;
+    } else {
+        tok = self.authenticator.token(&self.scopes).await?;
     }
-    let tok = self.authenticator.token(&self.scopes).await?;
     let mut url_params = format!("?oauth_token={token}&fields=*", token=tok.as_str());
     {{#params}}
     if let Some(ref val) = &params.{{{snake_param}}} {