From a58548a4d4afcbce89c02f80ae367d93fc43eed1 Mon Sep 17 00:00:00 2001 From: wayne warren Date: Sun, 9 Apr 2023 11:23:15 -0600 Subject: [PATCH] app/*: obey clippy --- app/chrome/src/main.rs | 6 ++---- app/discord/src/main.rs | 6 ++---- app/firefox/src/main.rs | 2 +- app/skype/src/main.rs | 12 ++++-------- app/steam/src/main.rs | 6 ++---- app/thinkorswim/src/main.rs | 6 ++---- app/zoom/src/main.rs | 6 ++---- src/dfiles/config.rs | 24 ++++++++++++------------ 8 files changed, 27 insertions(+), 41 deletions(-) diff --git a/app/chrome/src/main.rs b/app/chrome/src/main.rs index 5237280..9839dfc 100644 --- a/app/chrome/src/main.rs +++ b/app/chrome/src/main.rs @@ -17,8 +17,7 @@ impl aspects::ContainerAspect for Chrome { vec![ aspects::DockerfileSnippet { order: 91, - content: format!( - r#" + content: r#" ADD https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb /src/google-talkplugin_current_amd64.deb RUN apt-get update && apt-get install -y --no-install-recommends \ libpango1.0-0 \ @@ -36,8 +35,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && dpkg -i /src/google-talkplugin_current_amd64.deb \ && apt-get purge --auto-remove -y curl \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /src/*.deb"#, - ), + && rm -rf /src/*.deb"#.to_string(), }, aspects::DockerfileSnippet { order: 75, diff --git a/app/discord/src/main.rs b/app/discord/src/main.rs index 472135c..d9e310c 100644 --- a/app/discord/src/main.rs +++ b/app/discord/src/main.rs @@ -17,15 +17,13 @@ impl aspects::ContainerAspect for Discord { vec![ aspects::DockerfileSnippet { order: 91, - content: format!( - r#"WORKDIR /opt/ + content: r#"WORKDIR /opt/ RUN curl https://dl.discordapp.net/apps/linux/0.0.25/discord-0.0.25.deb > /opt/discord.deb && \ dpkg --force-depends -i /opt/discord.deb ; rm /opt/discord.deb RUN apt-get update && apt-get --fix-broken install -y \ && apt-get purge --autoremove \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /src/*.deb "#, - ), + && rm -rf /src/*.deb "#.to_string(), }, aspects::DockerfileSnippet { order: 92, diff --git a/app/firefox/src/main.rs b/app/firefox/src/main.rs index 9fc65f9..d89adfc 100644 --- a/app/firefox/src/main.rs +++ b/app/firefox/src/main.rs @@ -8,7 +8,7 @@ use dfiles::containermanager::ContainerManager; #[derive(Clone)] struct Firefox {} -const VERSION: &'static str = "109.0.1"; +const VERSION: &str = "109.0.1"; impl aspects::ContainerAspect for Firefox { fn name(&self) -> String { diff --git a/app/skype/src/main.rs b/app/skype/src/main.rs index 6ba2147..953e5ef 100644 --- a/app/skype/src/main.rs +++ b/app/skype/src/main.rs @@ -25,8 +25,7 @@ RUN chmod 644 /etc/fonts/local.conf"#, }, aspects::DockerfileSnippet { order: 91, - content: format!( - r#"# Add the skype debian repo + content: r#"# Add the skype debian repo RUN curl -sSL https://repo.skype.com/data/SKYPE-GPG-KEY | apt-key add - RUN echo "deb [arch=amd64] https://repo.skype.com/deb stable main" > /etc/apt/sources.list.d/skype.list @@ -35,15 +34,12 @@ RUN apt-get update && apt-get -y install \ skypeforlinux \ && apt-get purge --autoremove \ && rm -rf /var/lib/apt/lists/* -"#, - ), +"#.to_string(), }, aspects::DockerfileSnippet { order: 92, - content: format!( - r#"COPY /run-skype-and-wait-for-exit /usr/local/bin -RUN chmod 755 /usr/local/bin/run-skype-and-wait-for-exit"#, - ), + content: r#"COPY /run-skype-and-wait-for-exit /usr/local/bin +RUN chmod 755 /usr/local/bin/run-skype-and-wait-for-exit"#.to_string(), }, ] } diff --git a/app/steam/src/main.rs b/app/steam/src/main.rs index 98fa5ce..8cf67c5 100644 --- a/app/steam/src/main.rs +++ b/app/steam/src/main.rs @@ -16,16 +16,14 @@ impl aspects::ContainerAspect for Steam { fn dockerfile_snippets(&self) -> Vec { vec![aspects::DockerfileSnippet { order: 91, - content: format!( - r#"RUN dpkg --add-architecture i386 + content: r#"RUN dpkg --add-architecture i386 RUN sed -i -e 's|main|main contrib non-free|' /etc/apt/sources.list RUN apt-get update && yes 'I AGREE' | apt-get install -y \ steam \ && apt-get purge --autoremove \ && rm -rf /var/lib/apt/lists/* \ && rm -rf /src/*.deb -RUN chmod 4755 /opt/Signal/chrome-sandox"#, - ), +RUN chmod 4755 /opt/Signal/chrome-sandox"#.to_string(), }] } } diff --git a/app/thinkorswim/src/main.rs b/app/thinkorswim/src/main.rs index 287b511..d533d60 100644 --- a/app/thinkorswim/src/main.rs +++ b/app/thinkorswim/src/main.rs @@ -19,13 +19,11 @@ impl aspects::ContainerAspect for Thinkorswim { vec![ aspects::DockerfileSnippet { order: 90, - content: format!( - r#" + content: r#" RUN apt-get update && apt-get install -y --no-install-recommends \ openjdk-11-jre \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /src/*.deb"#, - ), + && rm -rf /src/*.deb"#.to_string(), }, aspects::DockerfileSnippet { order: 91, diff --git a/app/zoom/src/main.rs b/app/zoom/src/main.rs index e2db2d0..4bff6ef 100644 --- a/app/zoom/src/main.rs +++ b/app/zoom/src/main.rs @@ -16,15 +16,13 @@ impl aspects::ContainerAspect for Zoom { fn dockerfile_snippets(&self) -> Vec { vec![aspects::DockerfileSnippet { order: 91, - content: format!( - r#"WORKDIR /opt/ + content: r#"WORKDIR /opt/ RUN curl -L https://zoom.us/client/latest/zoom_amd64.deb -o /opt/zoom_amd64.deb && \ dpkg --force-depends -i /opt/zoom_amd64.deb && rm /opt/zoom_amd64.deb RUN apt-get update && apt-get --fix-broken install -y \ && apt-get purge --autoremove \ && rm -rf /var/lib/apt/lists/* \ - && rm -rf /src/*.deb "#, - ), + && rm -rf /src/*.deb "#.to_string(), }] } } diff --git a/src/dfiles/config.rs b/src/dfiles/config.rs index 8c8360b..3d4ff66 100644 --- a/src/dfiles/config.rs +++ b/src/dfiles/config.rs @@ -269,17 +269,17 @@ mod merge_should { ); assert_eq!( - merge(&Some(left.clone()), &empty.clone(), false), + merge(&Some(left.clone()), &empty, false), Some(vec![1, 2, 3, 4]) ); - assert_eq!(merge(&Some(left.clone()), &empty.clone(), true), None); + assert_eq!(merge(&Some(left), &empty, true), None); assert_eq!( - merge(&empty.clone(), &Some(right.clone()), false), + merge(&empty, &Some(right.clone()), false), Some(vec![5, 6, 7]) ); assert_eq!( - merge(&empty.clone(), &Some(right.clone()), true), + merge(&empty, &Some(right), true), Some(vec![5, 6, 7]) ); } @@ -289,16 +289,16 @@ mod merge_should { let none: Option> = None; let empty: Option> = Some(Vec::new()); - assert_eq!(merge(&none.clone(), &none.clone(), true), None); - assert_eq!(merge(&none.clone(), &none.clone(), false), None); + assert_eq!(merge(&none, &none, true), None); + assert_eq!(merge(&none, &none, false), None); - assert_eq!(merge(&none.clone(), &empty.clone(), true), None); - assert_eq!(merge(&none.clone(), &empty.clone(), false), None); + assert_eq!(merge(&none, &empty, true), None); + assert_eq!(merge(&none, &empty, false), None); - assert_eq!(merge(&empty.clone(), &empty.clone(), true), None); - assert_eq!(merge(&empty.clone(), &empty.clone(), false), None); + assert_eq!(merge(&empty, &empty, true), None); + assert_eq!(merge(&empty, &empty, false), None); - assert_eq!(merge(&empty.clone(), &none.clone(), true), None); - assert_eq!(merge(&empty.clone(), &none.clone(), false), None); + assert_eq!(merge(&empty, &none, true), None); + assert_eq!(merge(&empty, &none, false), None); } }