-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclippy-diff.log
66 lines (60 loc) · 2.67 KB
/
clippy-diff.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
diff --git a/examples/l03_variable/src/main.rs b/examples/l03_variable/src/main.rs
index b876c0c..07c98c6 100644
--- a/examples/l03_variable/src/main.rs
+++ b/examples/l03_variable/src/main.rs
@@ -18,7 +18,7 @@ pub fn use_constraint() {
println!("calc value = {}", result);
println!("SAMPLE_NAME = {}", SAMPLE_NAME);
unsafe {
- for v in &vec![1, 2, 3, 4, 5, 6, 7, 8, 9] {
+ for v in &[1, 2, 3, 4, 5, 6, 7, 8, 9] {
calc_total(*v);
}
println!("TOTAL_VALUE = {}", TOTAL_VALUE);
diff --git a/iriam-profile/src/main.rs b/iriam-profile/src/main.rs
index 6806752..8340ec7 100644
--- a/iriam-profile/src/main.rs
+++ b/iriam-profile/src/main.rs
@@ -312,7 +312,7 @@ fn test_trait_and_struct_01() {
}
-fn example<'a>(x: &'a str) -> &'a str {
+fn example(x: &str) -> &str {
x
}
/// 匿名ライフタイム
@@ -383,7 +383,7 @@ mod tests_lifetime {
}
fn return_short_lifetime_return_string(v: &[String]) -> String {
- v.get(2).map(|s| s.clone()).unwrap_or_else(|| "".to_string())
+ v.get(2).cloned().unwrap_or_default()
}
use std::borrow::Cow;
diff --git a/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3-v1.rs b/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3-v1.rs
index 3ef16c0..eaf4d19 100644
--- a/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3-v1.rs
+++ b/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3-v1.rs
@@ -4,7 +4,6 @@ use std::env;
use std::error::Error;
use std::fs::File;
use std::path::Path;
-use tokio::main;
// API Response のjson を構造体で定義
#[derive(Serialize, Deserialize, Debug)]
diff --git a/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3.rs b/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3.rs
index 373d760..4bffb9c 100644
--- a/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3.rs
+++ b/practice_collection/youtube_to_mp3/src/bin/youtube_to_mp3.rs
@@ -33,12 +33,12 @@ const MAX_RESULTS: u32 = 50;
fn search_videos(api_key: &str, query: &str) -> Result<Vec<SearchResult>, Box<dyn Error>> {
let url = format!("https://www.googleapis.com/youtube/v3/search?key={}&part=snippet&q={}&maxResults={}&type=video", api_key, query, MAX_RESULTS);
let client = Client::new();
- let response = client.get(&url).send()?.json::<SearchResponse>()?;
+ let response = client.get(url).send()?.json::<SearchResponse>()?;
//println!("{:?}", seade_json::to_json::<SearchResponse>(response));
Ok(response.items)
}
fn sanitize_filename(filename: &str) -> String {
- filename.replace("/", "_")
+ filename.replace('/', "_")
}
fn download_video(video_id: &str, output_dir: &str) -> Result<PathBuf, Box<dyn Error>> {