From d0fb8d765a7be15dce1be92197baf0de8c18a8ef Mon Sep 17 00:00:00 2001 From: Jakob Demler Date: Tue, 2 Aug 2016 22:57:32 +0200 Subject: [PATCH] No warning when file is opened with read truncate and write --- clippy_lints/src/open_options.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index 558007479..f47c593e0 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -178,7 +178,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span } } - if read && truncate && read_arg && truncate_arg { + if read && truncate && read_arg && truncate_arg && !(write && write_arg) { span_lint(cx, NONSENSICAL_OPEN_OPTIONS, span, "file opened with \"truncate\" and \"read\""); } if append && truncate && append_arg && truncate_arg {