From 4fcdf902f7ae5cd0425f708b483bbf2d81db0e35 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Fri, 26 Jun 2026 16:04:15 +0800 Subject: [PATCH] fix: use rust raw string literal syntax for quote mark escape --- wfassoc-exec/src/runner.rs | 2 +- wfassoc/src/highlevel/program.rs | 12 ++++++------ wfassoc/src/win32/concept.rs | 20 ++++++++++---------- wfassoc/tests/common.rs | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/wfassoc-exec/src/runner.rs b/wfassoc-exec/src/runner.rs index 41df10c..bbedcf4 100644 --- a/wfassoc-exec/src/runner.rs +++ b/wfassoc-exec/src/runner.rs @@ -35,7 +35,7 @@ pub enum Error { #[error("given extension name {0} is not presented in application")] BadExtName(String), /// Find star (*) extension name with other extension names when converting extension name to index - #[error("wildcard extension name \"*\" is not allowed to be used with other extension names")] + #[error(r#"wildcard extension name "*" is not allowed to be used with other extension names"#)] ExclusiveStarExtName, } diff --git a/wfassoc/src/highlevel/program.rs b/wfassoc/src/highlevel/program.rs index 0682ecf..76554ec 100644 --- a/wfassoc/src/highlevel/program.rs +++ b/wfassoc/src/highlevel/program.rs @@ -421,7 +421,7 @@ impl Program { for program_key in &mut self.ext_keys { let progid_key = &mut program_key.progid_key; debug_println!( - "Adding ProgId \"{0}\" subkey...", + r#"Adding ProgId "{0}" subkey..."#, progid_key.inner().to_string() ); @@ -464,7 +464,7 @@ impl Program { for program_key in &mut self.ext_keys { let progid_key = &mut program_key.progid_key; debug_println!( - "Deleting ProgId \"{0}\" subkey...", + r#"Deleting ProgId "{0}" subkey..."#, progid_key.inner().to_string() ); @@ -512,7 +512,7 @@ impl Program { for program_key in &self.ext_keys { let progid_key = &program_key.progid_key; debug_println!( - "Checking ProgId \"{0}\" subkey...", + r#"Checking ProgId "{0}" subkey..."#, progid_key.inner().to_string() ); @@ -532,7 +532,7 @@ impl Program { let ext_key = &mut program_key.ext_key; let progid_key = &program_key.progid_key; debug_println!( - "Linking ProgId \"{0}\" to extension \"{1}\" subkey...", + r#"Linking ProgId "{0}" to extension "{1}" subkey..."#, progid_key.inner().to_string(), ext_key.inner().to_string() ); @@ -556,7 +556,7 @@ impl Program { Some(program_key) => { let ext_key = &mut program_key.ext_key; debug_println!( - "Unlinking for extension \"{0}\" subkey...", + r#"Unlinking for extension "{0}" subkey..."#, ext_key.inner().to_string() ); @@ -586,7 +586,7 @@ impl Program { Some(program_key) => { let ext_key = &program_key.ext_key; debug_println!( - "Querying for extension \"{0}\"subkey...", + r#"Querying for extension "{0}"subkey..."#, ext_key.inner().to_string() ); diff --git a/wfassoc/src/win32/concept.rs b/wfassoc/src/win32/concept.rs index 00a12d4..a4f8a68 100644 --- a/wfassoc/src/win32/concept.rs +++ b/wfassoc/src/win32/concept.rs @@ -15,7 +15,7 @@ use windows_sys::Win32::UI::WindowsAndMessaging::HICON; /// The error occurs when constructing Ext with bad body. #[derive(Debug, TeError)] -#[error("given file extension body \"{inner}\" is invalid")] +#[error(r#"given file extension body "{inner}" is invalid"#)] pub struct BadExtBodyError { /// The clone of string which is not a valid file extension body. inner: String, @@ -83,7 +83,7 @@ impl Ext { /// The error occurs when try parsing string into FileExt. #[derive(Debug, TeError)] -#[error("given file extension name \"{inner}\" is invalid")] +#[error(r#"given file extension name "{inner}" is invalid"#)] pub struct ParseExtError { /// The clone of string which is not a valid file extension. inner: String, @@ -124,7 +124,7 @@ impl FromStr for Ext { /// The error occurs when constructing ProgId. #[derive(Debug, TeError)] -#[error("given ProgId part \"{inner}\" is invalid")] +#[error(r#"given ProgId part "{inner}" is invalid"#)] pub struct BadProgIdPartError { /// The clone of string which is not a valid ProgId part. inner: String, @@ -208,7 +208,7 @@ impl ProgId { /// The error occurs when parsing ProgId. #[derive(Debug, TeError)] -#[error("given ProgId \"{inner}\" is invalid")] +#[error(r#"given ProgId "{inner}" is invalid"#)] pub struct ParseProgIdError { /// The clone of string which is not a valid ProgId. inner: String, @@ -294,7 +294,7 @@ impl Clsid { /// The error occurs when parsing CLSID. #[derive(Debug, TeError)] -#[error("given string \"{inner}\" is invalid for CLSID")] +#[error(r#"given string "{inner}" is invalid for CLSID"#)] pub struct ParseClsidError { /// The clone of string which is not a valid CLSID. inner: String, @@ -331,7 +331,7 @@ impl Display for Clsid { /// Error occurs when given string is not a valid Icon Reference String. #[derive(Debug, TeError)] -#[error("given string \"{inner}\" is not a valid Icon Reference String")] +#[error(r#"given string "{inner}" is not a valid Icon Reference String"#)] pub struct ParseIconRefStrError { /// The clone of string which is not a valid Icon Reference String inner: String, @@ -442,7 +442,7 @@ impl FromStr for IconRefStr { /// Error occurs when given string is not a valid String Reference String. #[derive(Debug, TeError)] -#[error("given string \"{inner}\" is not a valid String Reference String")] +#[error(r#"given string "{inner}" is not a valid String Reference String"#)] pub struct ParseStrRefStrError { /// The clone of string which is not a valid String Reference String inner: String, @@ -1031,7 +1031,7 @@ impl Verb { /// The error occurs when parsing Verb with bad verb name. #[derive(Debug, TeError)] -#[error("given verb \"{inner}\" is illegal")] +#[error(r#"given verb "{inner}" is illegal"#)] pub struct ParseVerbError { inner: String, } @@ -1076,7 +1076,7 @@ impl FromStr for Verb { /// The error occurs when constructing CmdLine with bad arguments. #[derive(Debug, TeError)] -#[error("given command line argument \"{inner}\" is invalid")] +#[error(r#"given command line argument "{inner}" is invalid"#)] pub struct BadCmdLineError { inner: String, } @@ -1162,7 +1162,7 @@ impl CmdLine { /// The error occurs when parsing CmdLine with bad syntax. #[derive(Debug, TeError)] -#[error("given command line \"{inner}\" is invalid")] +#[error(r#"given command line "{inner}" is invalid"#)] pub struct ParseCmdLineError { inner: String, } diff --git a/wfassoc/tests/common.rs b/wfassoc/tests/common.rs index c8f73ef..d22fb12 100644 --- a/wfassoc/tests/common.rs +++ b/wfassoc/tests/common.rs @@ -10,7 +10,7 @@ pub fn check_sandbox() { concat!( "Non-sandbox environment detected. ", "Executing these tests in non-sandbox environment is VERY dangerous. ", - "Please set \"SANDBOXIE\" environment variable to explicitly indicate you are running these tests in sandbox environment." + r#"Please set "SANDBOXIE" environment variable to explicitly indicate you are running these tests in sandbox environment."# ) ) }