on master help sign in
Remove .unwrap() to prevent crashes
commita46191b8bfb69b18a0865b6c7d2b0fabf4011ede authorsharkdp <davidpeter@web.de> dateThu 1 Oct 2020, 20:25 (6 years ago) parent9c4c3e9
1 file changed+3−6
src/syntax_mapping.rs+3−6
src/syntax_mapping.rs+3−6
@@ -111,8 +111,7 @@ impl<'a> SyntaxMapping<'a> {
111111 &git_config_path
112112 .join("config")
113113 .into_os_string()
114− .to_str()
115− .unwrap(),
114+ .to_string_lossy(),
116115 MappingTarget::MapTo("Git Config"),
117116 )
118117 .unwrap();
@@ -122,8 +121,7 @@ impl<'a> SyntaxMapping<'a> {
122121 &git_config_path
123122 .join("ignore")
124123 .into_os_string()
125− .to_str()
126− .unwrap(),
124+ .to_string_lossy(),
127125 MappingTarget::MapTo("Git Ignore"),
128126 )
129127 .unwrap();
@@ -133,8 +131,7 @@ impl<'a> SyntaxMapping<'a> {
133131 &git_config_path
134132 .join("attributes")
135133 .into_os_string()
136− .to_str()
137− .unwrap(),
134+ .to_string_lossy(),
138135 MappingTarget::MapTo("Git Attributes"),
139136 )
140137 .unwrap();