Fix new Clippy warnings
Browse files at this commitdfb368318755a902bad97db69a54c25cd6140b72Parent: ce9ba009 changed files +14 -21
- niri-config/src/lib.rs +1 -1
- niri-config/tests/wiki-parses.rs +1 -2
- src/backend/tty.rs +3 -3
- src/dbus/mutter_display_config.rs +3 -8
- src/dbus/mutter_screen_cast.rs +1 -1
- src/ipc/client.rs +1 -1
- src/niri.rs +1 -1
- src/render_helpers/shader_element.rs +2 -2
- src/ui/config_error_notification.rs +1 -2
niri-config/src/lib.rsmodified+1 -1
| @@ -3079,7 +3079,7 @@ impl<S: knuffel::traits::ErrorSpan> knuffel::DecodeScalar<S> for WorkspaceName { | |||
| 3079 | ctx.emit_error(DecodeError::unexpected( | 3079 | ctx.emit_error(DecodeError::unexpected( |
| 3080 | val, | 3080 | val, |
| 3081 | "named workspace", | 3081 | "named workspace", |
| 3082 | - format!("duplicate named workspace: {}", s), | 3082 | + format!("duplicate named workspace: {s}"), |
| 3083 | )); | 3083 | )); |
| 3084 | return Ok(Self(String::new())); | 3084 | return Ok(Self(String::new())); |
| 3085 | } | 3085 | } |
niri-config/tests/wiki-parses.rsmodified+1 -2
| @@ -95,8 +95,7 @@ fn wiki_docs_parses() { | |||
| 95 | } | 95 | } |
| 96 | } else if must_fail { | 96 | } else if must_fail { |
| 97 | errors.push(format!( | 97 | errors.push(format!( |
| 98 | - "Expected error parsing wiki KDL code block at {}:{}", | 98 | + "Expected error parsing wiki KDL code block at {filename}:{line_number}", |
| 99 | - filename, line_number | ||
| 100 | )); | 99 | )); |
| 101 | } | 100 | } |
| 102 | } | 101 | } |
src/backend/tty.rsmodified+3 -3
| @@ -316,11 +316,11 @@ impl Tty { | |||
| 316 | 316 | ||
| 317 | let mut node_path = String::new(); | 317 | let mut node_path = String::new(); |
| 318 | if let Some(path) = primary_render_node.dev_path() { | 318 | if let Some(path) = primary_render_node.dev_path() { |
| 319 | - write!(node_path, "{:?}", path).unwrap(); | 319 | + write!(node_path, "{path:?}").unwrap(); |
| 320 | } else { | 320 | } else { |
| 321 | - write!(node_path, "{}", primary_render_node).unwrap(); | 321 | + write!(node_path, "{primary_render_node}").unwrap(); |
| 322 | } | 322 | } |
| 323 | - info!("using as the render node: {}", node_path); | 323 | + info!("using as the render node: {node_path}"); |
| 324 | 324 | ||
| 325 | Ok(Self { | 325 | Ok(Self { |
| 326 | config, | 326 | config, |
src/dbus/mutter_display_config.rsmodified+3 -8
| @@ -189,8 +189,7 @@ impl DisplayConfig { | |||
| 189 | for (connector, mode, _props) in requested_config.monitors { | 189 | for (connector, mode, _props) in requested_config.monitors { |
| 190 | if !current_conf.values().any(|o| o.name == connector) { | 190 | if !current_conf.values().any(|o| o.name == connector) { |
| 191 | return Err(zbus::fdo::Error::Failed(format!( | 191 | return Err(zbus::fdo::Error::Failed(format!( |
| 192 | - "Connector '{}' not found", | 192 | + "Connector '{connector}' not found", |
| 193 | - connector | ||
| 194 | ))); | 193 | ))); |
| 195 | } | 194 | } |
| 196 | new_conf.insert( | 195 | new_conf.insert( |
| @@ -210,8 +209,7 @@ impl DisplayConfig { | |||
| 210 | 7 => niri_ipc::Transform::Flipped270, | 209 | 7 => niri_ipc::Transform::Flipped270, |
| 211 | x => { | 210 | x => { |
| 212 | return Err(zbus::fdo::Error::Failed(format!( | 211 | return Err(zbus::fdo::Error::Failed(format!( |
| 213 | - "Unknown transform {}", | 212 | + "Unknown transform {x}", |
| 214 | - x | ||
| 215 | ))) | 213 | ))) |
| 216 | } | 214 | } |
| 217 | }, | 215 | }, |
| @@ -220,10 +218,7 @@ impl DisplayConfig { | |||
| 220 | y: requested_config.y, | 218 | y: requested_config.y, |
| 221 | }), | 219 | }), |
| 222 | mode: Some(niri_ipc::ConfiguredMode::from_str(&mode).map_err(|e| { | 220 | mode: Some(niri_ipc::ConfiguredMode::from_str(&mode).map_err(|e| { |
| 223 | - zbus::fdo::Error::Failed(format!( | 221 | + zbus::fdo::Error::Failed(format!("Could not parse mode '{mode}': {e}")) |
| 224 | - "Could not parse mode '{}': {}", | ||
| 225 | - mode, e | ||
| 226 | - )) | ||
| 227 | })?), | 222 | })?), |
| 228 | // FIXME: VRR | 223 | // FIXME: VRR |
| 229 | ..Default::default() | 224 | ..Default::default() |
src/dbus/mutter_screen_cast.rsmodified+1 -1
| @@ -120,7 +120,7 @@ impl ScreenCast { | |||
| 120 | 120 | ||
| 121 | static NUMBER: AtomicUsize = AtomicUsize::new(0); | 121 | static NUMBER: AtomicUsize = AtomicUsize::new(0); |
| 122 | let session_id = NUMBER.fetch_add(1, Ordering::SeqCst); | 122 | let session_id = NUMBER.fetch_add(1, Ordering::SeqCst); |
| 123 | - let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{}", session_id); | 123 | + let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{session_id}"); |
| 124 | let path = OwnedObjectPath::try_from(path).unwrap(); | 124 | let path = OwnedObjectPath::try_from(path).unwrap(); |
| 125 | 125 | ||
| 126 | let session = Session::new(session_id, self.ipc_outputs.clone(), self.to_niri.clone()); | 126 | let session = Session::new(session_id, self.ipc_outputs.clone(), self.to_niri.clone()); |
src/ipc/client.rsmodified+1 -1
| @@ -297,7 +297,7 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> { | |||
| 297 | let [r, g, b] = color.rgb.map(|v| (v.clamp(0., 1.) * 255.).round() as u8); | 297 | let [r, g, b] = color.rgb.map(|v| (v.clamp(0., 1.) * 255.).round() as u8); |
| 298 | 298 | ||
| 299 | println!("Picked color: rgb({r}, {g}, {b})",); | 299 | println!("Picked color: rgb({r}, {g}, {b})",); |
| 300 | - println!("Hex: #{:02x}{:02x}{:02x}", r, g, b); | 300 | + println!("Hex: #{r:02x}{g:02x}{b:02x}"); |
| 301 | } else { | 301 | } else { |
| 302 | println!("No color was picked."); | 302 | println!("No color was picked."); |
| 303 | } | 303 | } |
src/niri.rsmodified+1 -1
| @@ -5242,7 +5242,7 @@ impl Niri { | |||
| 5242 | 5242 | ||
| 5243 | let dbus = &self.dbus.as_ref().unwrap(); | 5243 | let dbus = &self.dbus.as_ref().unwrap(); |
| 5244 | let server = dbus.conn_screen_cast.as_ref().unwrap().object_server(); | 5244 | let server = dbus.conn_screen_cast.as_ref().unwrap().object_server(); |
| 5245 | - let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{}", session_id); | 5245 | + let path = format!("/org/gnome/Mutter/ScreenCast/Session/u{session_id}"); |
| 5246 | if let Ok(iface) = server.interface::<_, mutter_screen_cast::Session>(path) { | 5246 | if let Ok(iface) = server.interface::<_, mutter_screen_cast::Session>(path) { |
| 5247 | let _span = tracy_client::span!("invoking Session::stop"); | 5247 | let _span = tracy_client::span!("invoking Session::stop"); |
| 5248 | 5248 | ||
src/render_helpers/shader_element.rsmodified+2 -2
| @@ -70,9 +70,9 @@ unsafe fn compile_program( | |||
| 70 | texture_uniforms: &[&str], | 70 | texture_uniforms: &[&str], |
| 71 | // destruction_callback_sender: Sender<CleanupResource>, | 71 | // destruction_callback_sender: Sender<CleanupResource>, |
| 72 | ) -> Result<ShaderProgram, GlesError> { | 72 | ) -> Result<ShaderProgram, GlesError> { |
| 73 | - let shader = format!("#version 100\n{}", src); | 73 | + let shader = format!("#version 100\n{src}"); |
| 74 | let program = unsafe { link_program(gl, include_str!("shaders/texture.vert"), &shader)? }; | 74 | let program = unsafe { link_program(gl, include_str!("shaders/texture.vert"), &shader)? }; |
| 75 | - let debug_shader = format!("#version 100\n#define DEBUG_FLAGS\n{}", src); | 75 | + let debug_shader = format!("#version 100\n#define DEBUG_FLAGS\n{src}"); |
| 76 | let debug_program = | 76 | let debug_program = |
| 77 | unsafe { link_program(gl, include_str!("shaders/texture.vert"), &debug_shader)? }; | 77 | unsafe { link_program(gl, include_str!("shaders/texture.vert"), &debug_shader)? }; |
| 78 | 78 | ||
src/ui/config_error_notification.rsmodified+1 -2
| @@ -187,8 +187,7 @@ fn render( | |||
| 187 | if let Some(path) = created_path { | 187 | if let Some(path) = created_path { |
| 188 | text = format!( | 188 | text = format!( |
| 189 | "Created a default config file at \ | 189 | "Created a default config file at \ |
| 190 | - <span face='monospace' bgcolor='#000000'>{:?}</span>", | 190 | + <span face='monospace' bgcolor='#000000'>{path:?}</span>", |
| 191 | - path | ||
| 192 | ); | 191 | ); |
| 193 | border_color = (0.5, 1., 0.5); | 192 | border_color = (0.5, 1., 0.5); |
| 194 | }; | 193 | }; |